I have a requirement to generate following associative array from a for-loop .
Array ( [0] =>
Array (
[id] => 1
[value] => 6
) [1] =>
Array (
[id] => 2
[value] => 7
) [2] =>
Array (
[id] => 3
[value] => 8
)
)
Tried this code
$total_pages = 3;
$pagination = array();
for ($i=1; $i<=$total_pages; $i++) {
$pagination[]['id'] = $i;
$pagination[]['value'] = $i + 5;
};
I have tried this code but cannot able to generate an associative array. Not sure about how to do it. Please help me to solve this issue. Thank you