I need to be able to set my object like this:
$obj->foo = 'bar';
then I need to use it as an array like that:
if($obj['foo'] == 'bar'){ //more code here }
Just add implements ArrayAccess
to your class and add the required methods:
See http://php.net/manual/en/class.arrayaccess.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