I got an array with this structure and I am trying to get one element from it:
Array
(
[0] => Array
(
[description] =>
[idProduct] => Array
(
[id1] => 7227
[idProduct] => 3
)
[idSite] => 2592
[name] => Parcela Azul
[picture] =>
)
[1] => Array
(
[description] =>
[idProduct] => Array
(
[id1] => 7227
[idProduct] => 8
)
[idSite] => 2592
[name] => Apartamento 2 pax
[picture] =>
)
)
so, I got a variable that stores the array. My question is:
Why this works:
$test = $categorias[0];
$test2 = $test['name'];
echo "<pre>";
print_r($test2);
echo "</pre>";
Result: Parcela Azul
And this doesn’t:
$test = $categorias[0]['name'];
echo "<pre>";
print_r($test);
echo "</pre>";
Here What I have get
If you are playing with the system index then it will create some issue. You should remove the system indexing values.