Created
January 26, 2013 14:33
-
-
Save blerou/4642736 to your computer and use it in GitHub Desktop.
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
$ php -a | |
Interactive shell | |
php > $obj = new stdClass; | |
php > $numKey = 123; | |
php > $obj->{$numKey} = 'foo'; | |
php > $ary = (array) $obj; | |
php > var_dump($obj, $ary); | |
class stdClass#1 (1) { | |
public $123 => | |
string(3) "foo" | |
} | |
array(1) { | |
'123' => | |
string(3) "foo" | |
} | |
php > var_dump($ary[123]); | |
NULL | |
php > var_dump($ary['123']); | |
NULL | |
php > |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment