Reputation: 2501
Here is the result on the page when using print_r($result);
Array
(
[result] => Array
(
[0] => Array
(
[username] => Elvis
)
)
)
I would like to pull this out of the array and use it as a PHP variable. I have tried extract
, while loops
and a variety of other solutions, but I am not finding the right syntax to make this happen. What is the easiest way? Thanks.
Upvotes: 0
Views: 63
Reputation: 3729
If the array is consistent, just like you showed it, then you just need
$username=$result['result'][0]['username'];
Upvotes: 2