1

Here is the result of var_dump($my_var["id"]) on the object I'm having issues with:

array(1) { ["$t"]=> string(38) "tag:youtube.com,2008:video:PFtBzEqYOhc" } 

I want to access the string(38) part of that associative array, but when I type:

echo $my_var["id"]["$t"] 

I get nothing. What's the problem?

3
  • You should consider this as bad practice, this is not a speaking key name. Choose some different name, without dollars and you wouldn't have any trouble with it Commented Mar 25, 2012 at 3:22
  • someone tell the youtube guys, as this is their API i'm handling Commented Mar 25, 2012 at 3:35
  • google sucks more everyday :) Commented Mar 25, 2012 at 3:38

1 Answer 1

2

In double quotes, dollar signs start variable references. Use single quotes:

echo $my_var['id']['$t'];

For more information, refer to the php manual.

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.