I have an array in the below format which I am showing in a datatable:
Array
(
[0] => Array
(
[id] => 67
[name] => test1
[contactnumber] => 1234567890
[status] => 1
)
[1] => Array
(
[id] => 73
[name] => test2
[contactnumber] => 1232123432
[status] => 2
)
[2] => Array
(
[id] => 65
[name] => test3
[contactnumber] => 7890987890
[status] => 1
)
)
I am using a foreach to access all the records:
foreach($resultleads as $resultleadsdata)
And the below code to get the previous iteration id, which is not working, I am getting some random ids instead of the previous one:
$previd=0;
foreach($resultleads as $resultleadsdata) {
echo $previd;
$previd=$resultleadsdata['id'];
}
Have tried with the next() function also, which is giving the name instead of id.