如何从此多维PHP数组中获取单个值 [英] How to get single value from this multi-dimensional PHP array

查看:84
本文介绍了如何从此多维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,例如:

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

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

推荐答案

查看print_r中的键和缩进:

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

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

...等

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆