I dont understand why my array gets cut in loop?
Array
(
[0] => Array
(
[name] => order
[value] => asd
)
[1] => Array
(
[name] => item
[value] => aa
)
[2] => Array
(
[name] => quant
[value] => 5
)
[3] => Array
(
[name] => price
[value] => 20
)
)
My php code with for loop:
for($i = 0; $i < count($json_array); $i++)
{
echo $json_array[$i]['name'];
}
The result I'm getting is: orderitemquant but why last value price is gone? What is wrong with this code?
print_r($json_array);orderitemquantpriceso you are misrepresenting something. There should be no spaces in your output for instance. Are you leaving out the logic that creates the space?