一尘不染

如何从此多维PHP数组中获取单个值

php

print_r($myarray)

Array
(
    [0] => Array
    (
        [id] => 6578765
        [name] => John Smith
        [first_name] => John
        [last_name] => Smith
        [link] => http://www.example.com
        [gender] => male
        [email] => email@domain.com
        [timezone] => 8
        [updated_time] => 2010-12-07T21:02:21+0000
    )
)

问题,如何获得$myarray单一值,例如:

echo $myarray['email'];  will show email@domain.com

阅读 242

收藏
2020-05-26

共1个答案

一尘不染

查看您的中的键和缩进print_r

echo $myarray[0]['email'];

echo $myarray[0]['gender'];

…等等

2020-05-26