I was poking around PHPs casting mechanism, and ran into an odd case when casting an array as an object
$o = (object) array('1'=>'/foo/bar');
$o = new stdClass();
var_dump($o);
As I understand it, PHP properties need to be declared with the same rules as PHP variables. That is A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. However, the above code produces the following output
object(stdClass)#1 (1) {
[1]=>
string(8) "/foo/bar"
}
Where it gets really weird is when you try to access that information in the object.
var_dump($o->1); // parse error
var_dump($o->{'1'}); // NULL
var_dump(get_object_vars($o)); //array(0) { }
Is there anyway to get at the the information that var_dump reports is in the object, or is it just locked up for the rest of the request life cycle? (practical use of this is nil, I'm just curious)