jc-0wg
Last Updated: February 25, 2016
·
496
· rougin
Profile

Call arrays as objects in PHP

The trick in this tip is to include a (object) in the array().

$variable = (object)array('hello' => 'world', 'hi' => 'people')

Then you call it now as an object: echo $variable->hello;

Say Thanks
Respond