I need to know is there a way to create an object with properties with number instead of names in php, so I can get them like this:
$property = $obj->{1}
I need to know is there a way to create an object with properties with number instead of names in php, so I can get them like this:
$property = $obj->{1}
Er... Yes, you can. It's the very same syntax you are already using:
$obj = (object)nuLL;
$obj->{1} = 'Hi!';
var_dump($obj);
(Demo)
U can't set name property of object as integer . If you want iterate properties
get_object_vars($object);