Created
April 21, 2016 08:47
-
-
Save dunglas/8f4fb31ace313c95285a9344263f2d99 to your computer and use it in GitHub Desktop.
Access a PHP special key /cc @vincentchalamon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$c = (object) ['@context' => 'foo']; | |
var_dump($c); | |
/* | |
php shell code:1: | |
class stdClass#1 (1) { | |
public $@context => | |
string(3) "foo" | |
} | |
*/ | |
$key = '@context'; | |
var_dump($c->{$key}); | |
/* | |
php shell code:1: | |
string(3) "foo" | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment