Reputation: 175
$a=Array ([storage] => [submitted] => 1 [values] => Array ( [q] => googl [op]))
How can I get the value of q from this array $a->q doesn't give me the value. Why?
Upvotes: 1
Views: 139
Reputation: 1275
You use the -> on objects. For an array you need to index the variable like this:
echo $a['values']['q'];
Check this foreach tutorial for u can get more information
Upvotes: 0
Reputation: 34284
You use the ->
on objects. For an array you need to index the variable like this:
echo $a['values']['q'];
Upvotes: 2
Reputation: 86476
echo $a['values']['q'];
This is 2-d array you can get value like above.
you can also use the foreach to get retrieve values of arrays.
Upvotes: 1