本文介绍了如何从这个多维 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 protected]
        [timezone] => 8
        [updated_time] => 2010-12-07T21:02:21+0000
    )
)

问题,如何在单个值中获取$myarray,例如:

Question, how to get the $myarray in single value like:

echo $myarray['email'];  will show [email protected]

推荐答案

查看 print_r 中的键和缩进:

Look at the keys and indentation in your print_r:

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

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

...等

这篇关于如何从这个多维 PHP 数组中获取单个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 09:35