3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // *convert array to object* $array_name = ["id" => 321313,"username" => "shahbaz"]; $object = (object) $array_name; //now it is converted to object and you can access it. echo $object->username; $o = new ArrayObject($array_name); echo "\n",($o == $object)? 'true': 'false',"\n"; echo $o["username"];
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.0
shahbaz false shahbaz