When I run this bit
$data = (object)array(1,2,3);
print_r($data);
I get
stdClass Object
(
[0] => 1
[1] => 2
[2] => 3
)
This is rather interesting because I've known up until now that an object's property name cannot start with a number. So if that is true it must mean that these values are not properties, but what are they then?
A few ways I tried to access the values
$data[0]; // Fatal error: Cannot use object of type stdClass as array
$data->0; // Parse error: syntax error, unexpected 0, expecting identifier
$data->{0}; // Notice: Undefined property: stdClass::$0
I'm not really interested in accessing the values rather than finding out how they are kept in the class if they're not properties and not indexed values.