I am getting the first array by: // $data is fetched information from database // like select bookId from book;
$json = json_encode($data);
$data = json_decode($json, true);
I have an array like this: Array of Associative array.
0 =>
array (size=1)
'bookId' => int 3
1 =>
array (size=1)
'bookId' => int 4
2 =>
array (size=1)
'bookId' => int 5
3 =>
array (size=1)
'bookId' => int 6
What i need is simple array:
0 => 3
1 => 5
2 => 6
3 => 6
I do want to simple use a for loop. Is there any other good way to do this?