0

My code is as below.

            $code = json_decode($json,true);
    var_dump($code);
    echo "1";
    echo "Numbers of tweets containing this link : $code->{'count'}"; //some issue here  line (x)

but var_dump($code); gives:

array (size=2)
  'count' => int 1602
  'url' => string 'http://www.youtube.com/watch/?v=yOutxpoXnfg' (length=43)

what is wrong with my code? line x does not show any thing.

3
  • It's an array. Use $code['count']; Commented Dec 24, 2013 at 9:55
  • @FDL: that also does not work Commented Dec 24, 2013 at 9:59
  • then you are using it incorrectly. See the answer from Sudhir, that is how you need to use it. Commented Dec 24, 2013 at 10:00

1 Answer 1

3

true converts to associative array format for json_decode(), so change to:

echo "Numbers of tweets containing this link :". $code['count'];
Sign up to request clarification or add additional context in comments.

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.