3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $ob = new stdClass(); $ob->value = new stdClass(); $array = array('1'); $obi = new stcClass(); $obi->0 = 1; $ob->value = (object)$array; $ob->val = $obi; print_r($ob); print_r(object_to_array($ob)); function object_to_array( $object ) { if( ! is_array( $object ) && ! is_object( $object )) { return $object; } if( is_object( $object )) { $object = get_object_vars( $object ); } return array_map( 'object_to_array', $object ); }
Output for 5.4.0 - 5.4.18
Parse error: syntax error, unexpected '0' (T_LNUMBER), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /in/1sT8r on line 10
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_LNUMBER, expecting T_STRING or T_VARIABLE or '{' or '$' in /in/1sT8r on line 10
Process exited with code 255.