I have a stdClass Object like this:
print_r($myobj);
stdClass Object(
[0] => testData
);
So it is clear that I cannot get the value by $myobj->0
.
For getting this value I convert the object to an array, but are there any ways to get without converting?
Try this:
$obj = new stdClass();
$obj->{0} = 1;
echo $obj->{0};
source: http://php.net/manual/en/language.types.object.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With