开发者

parsing values in a php array

I am new to PHP, please help me with the stuff. Below is the code written followed by its results. How can i access [count] inside [property] in most effective way. code

echo '<pre>';
   print_r($result);
  echo '</pre>';

output

Array
(
    [0] => Array
        (
            [property] => Array
                (
                    [href] => http://www.example.com
                    [count] => 2
                    [sample] => Array
                        (
                        )

                    [data] => Array
                        (
              开发者_C百科              [0] => 100002067610524
                            [1] => 675985591
                        )

                    [users] => 
                    [active] => 1
                )

        )

)


Not the most effective, but the only possible ;-)

echo $result[0]['property']['count'];


if you have more than one element then use this

foreach($result as $childArray)
{
    echo $childArray['property']['count'];   
}

if you have only one element in it then use

$array = $result[0]['property']['count'];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜