[ create a new paste ] login | about

Link: http://codepad.org/FNeda0KY    [ raw code | output | fork ]

PHP, pasted on Apr 22:
1
2
3
4
5
6
7
8
9
10
<?php
$x = new stdclass;
$x->{"42"} = "wat";
$x = (array)$x;
var_dump($x);
var_dump($x["42"]);
var_dump($x[42]);
var_dump(array_keys($x));
$keys = array_keys($x);
var_dump($x[$keys[0]]);


Output:
1
2
3
4
5
6
7
8
9
10
11
array(1) {
  ["42"]=>
  string(3) "wat"
}
NULL
NULL
array(1) {
  [0]=>
  string(2) "42"
}
NULL


Create a new paste based on this one


Comments: