Tony Stark
Tony Stark

Reputation: 25538

issue accessing array value in associative array

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?

Upvotes: 1

Views: 46

Answers (1)

phihag
phihag

Reputation: 287835

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

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

For more information, refer to the php manual.

Upvotes: 2

Related Questions