3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class String { var $string = ''; function String($string = ''){ $this->string = strval($string); } function __toString(){ return $this->string; } } var_dump(get_object_vars("test")); var_dump((int)"123"); var_dump((float)"123"); var_dump((array)"123"); var_dump((string)"123"); var_dump((bool)"123"); var_dump((object)"123"); $x = "143"; $x[1] = "2"; var_dump((int)$x); var_dump((float)$x); var_dump((array)$x); var_dump((string)$x); var_dump((bool)$x); var_dump((object)$x); var_dump((int)new String("123")); var_dump((float)new String("123")); var_dump((array)new String("123")); var_dump((string)new String("123")); var_dump((bool)new String("123")); var_dump((object)new String("123"));
Output for hhvm-3.10.0
Warning: get_object_vars() expects parameter 1 to be object, string given in /in/XLD0d on line 14 NULL int(123) float(123) array(1) { [0]=> string(3) "123" } string(3) "123" bool(true) object(stdClass)#1 (1) { ["scalar"]=> string(3) "123" } int(123) float(123) array(1) { [0]=> string(3) "123" } string(3) "123" bool(true) object(stdClass)#1 (1) { ["scalar"]=> string(3) "123" } Notice: Object of class String could not be converted to int in /in/XLD0d on line 33 int(1) Notice: Object of class String could not be converted to int in /in/XLD0d on line 34 float(1) array(1) { ["string"]=> string(3) "123" } string(3) "123" bool(true) object(String)#1 (1) { ["string"]=> string(3) "123" }
Output for 5.3.0 - 5.6.28
Warning: get_object_vars() expects parameter 1 to be object, string given in /in/XLD0d on line 14 NULL int(123) float(123) array(1) { [0]=> string(3) "123" } string(3) "123" bool(true) object(stdClass)#1 (1) { ["scalar"]=> string(3) "123" } int(123) float(123) array(1) { [0]=> string(3) "123" } string(3) "123" bool(true) object(stdClass)#1 (1) { ["scalar"]=> string(3) "123" } Notice: Object of class String could not be converted to int in /in/XLD0d on line 33 int(1) Notice: Object of class String could not be converted to double in /in/XLD0d on line 34 float(1) array(1) { ["string"]=> string(3) "123" } string(3) "123" bool(true) object(String)#1 (1) { ["string"]=> string(3) "123" }
Output for 5.2.0 - 5.2.17
bool(false) int(123) float(123) array(1) { [0]=> string(3) "123" } string(3) "123" bool(true) object(stdClass)#1 (1) { ["scalar"]=> string(3) "123" } int(123) float(123) array(1) { [0]=> string(3) "123" } string(3) "123" bool(true) object(stdClass)#1 (1) { ["scalar"]=> string(3) "123" } Notice: Object of class String could not be converted to int in /in/XLD0d on line 33 int(1) Notice: Object of class String could not be converted to double in /in/XLD0d on line 34 float(1) array(1) { ["string"]=> string(3) "123" } string(3) "123" bool(true) object(String)#1 (1) { ["string"]=> string(3) "123" }
Output for 5.1.3 - 5.1.6
bool(false) int(123) float(123) array(1) { [0]=> string(3) "123" } string(3) "123" bool(true) object(stdClass)#1 (1) { ["scalar"]=> string(3) "123" } int(123) float(123) array(1) { [0]=> string(3) "123" } string(3) "123" bool(true) object(stdClass)#1 (1) { ["scalar"]=> string(3) "123" } Notice: Object of class String could not be converted to int in /in/XLD0d on line 33 int(1) Notice: Object of class String could not be converted to double in /in/XLD0d on line 34 float(1) array(1) { ["string"]=> string(3) "123" } string(12) "Object id #1" bool(true) object(String)#1 (1) { ["string"]=> string(3) "123" }
Output for 5.1.0 - 5.1.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/XLD0d on line 3 bool(false) int(123) float(123) array(1) { [0]=> string(3) "123" } string(3) "123" bool(true) object(stdClass)#1 (1) { ["scalar"]=> string(3) "123" } int(123) float(123) array(1) { [0]=> string(3) "123" } string(3) "123" bool(true) object(stdClass)#1 (1) { ["scalar"]=> string(3) "123" } Notice: Object of class String could not be converted to int in /in/XLD0d on line 33 int(1) Notice: Object of class String could not be converted to double in /in/XLD0d on line 34 float(1) array(1) { ["string"]=> string(3) "123" } string(12) "Object id #1" bool(true) object(String)#1 (1) { ["string"]=> string(3) "123" }
Output for 5.0.0 - 5.0.5
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/XLD0d on line 3 bool(false) int(123) float(123) array(1) { [0]=> string(3) "123" } string(3) "123" bool(true) object(stdClass)#1 (1) { ["scalar"]=> string(3) "123" } int(123) float(123) array(1) { [0]=> string(3) "123" } string(3) "123" bool(true) object(stdClass)#1 (1) { ["scalar"]=> string(3) "123" } object(String)#1 (1) { ["string"]=> string(3) "123" } Notice: Object of class String could not be converted to double in /in/XLD0d on line 34 float(1) array(1) { ["string"]=> string(3) "123" } string(12) "Object id #1" bool(true) object(String)#1 (1) { ["string"]=> string(3) "123" }
Output for 4.3.0 - 4.4.9
bool(false) int(123) float(123) array(1) { [0]=> string(3) "123" } string(3) "123" bool(true) object(stdClass)(1) { ["scalar"]=> string(3) "123" } int(123) float(123) array(1) { [0]=> string(3) "123" } string(3) "123" bool(true) object(stdClass)(1) { ["scalar"]=> string(3) "123" } int(1) float(1) array(1) { ["string"]=> string(3) "123" } Notice: Object to string conversion in /in/XLD0d on line 36 string(6) "Object" bool(true) object(string)(1) { ["string"]=> string(3) "123" }