0

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
                        (
                            [0] => 100002067610524
                            [1] => 675985591
                        )

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

        )

)

2 Answers 2

3

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

echo $result[0]['property']['count'];
Sign up to request clarification or add additional context in comments.

Comments

2

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'];

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.