PHP从多维数组中回显特定值

时间:2017-03-11 16:21:40

标签: php multidimensional-array

我将此数组存储到变量$ profile

 Array
    (
        [id] => 546645
        [name] => Big Foot
        [first_name] => Big
        [last_name] => Foot
        [email] => blabla@yourmail.com
        [gender] => male
        [picture] => Array
            (
                [is_silhouette] => 
                [url] => www.yourdomain.com/pic.png
            )

        [cover] => Array
            (
                [id] => 75647444
                [offset_y] => 100
                [source] => www.yourdomain.com/roar.png
            )       
    )

我如何从[url]和[source]获得价值? 我希望我能得到

  

www.yourdomain.com/pic.png

     

www.yourdomain.com/roar.png

我可以使用此代码获取其他值,但我不知道如何获取值[url]和[source]:

echo $profile['id'].'<br>';
echo $profile['name'].'<br>';
echo $profile['first_name'].'<br>';
echo $profile['last_name'].'<br>';
echo $profile['email'].'<br>';
echo $profile['gender'].'<br>';

谢谢。

0 个答案:

没有答案