I want to access the indexed multi dimensional array sent from my app.for the test purpose i am sending request by url.
xyz/?array1[0][id]=2&array1[0][value]=400
this is how i am receiving and echoing.
?php
$price[][]=$_REQUEST['array1'];
echo $price[0]['id'];
echo $price[0]['value'];
but i am getting array1 as $price[0]['id']
and $price[0]['value']
empty. also in error log its showing id and value not defined. Any help would be great.
You just don't need the [][] after your $price.
$price=$_REQUEST['array1'];
echo $price[0]['id'];
echo $price[0]['value'];
Your code is the equivalent of
$price = array(
0 => array(
0 => $_REQUEST
)
)
which means you need $price[0][0]['id']['value']
instead