3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $objA = new \stdClass(); $objA->A = 1; $objB = new \stdClass(); $objB->B = 2; $objC = new \stdClass(); $objC->C = 3; $objD = new \stdClass(); $objD->D = 4; $arr1 = [ $objA, $objC ]; $arr2 = [ $objB, $objD ]; var_dump(in_array($arr1, $objA)); var_dump(array_diff($arr1, $arr2));
Output for 7.1.0 - 7.3.0rc3
Warning: in_array() expects parameter 2 to be array, object given in /in/YlXPP on line 19 NULL Recoverable fatal error: Object of class stdClass could not be converted to string in /in/YlXPP on line 20
Process exited with code 255.
Output for 5.6.30, 7.0.0 - 7.0.31
Warning: in_array() expects parameter 2 to be array, object given in /in/YlXPP on line 19 NULL Catchable fatal error: Object of class stdClass could not be converted to string in /in/YlXPP on line 20
Process exited with code 255.
Output for hhvm-3.22.0
Warning: in_array() expects parameter 2 to be an array or collection in /in/YlXPP on line -1 bool(false) Fatal error: Uncaught Error: Object of class stdClass could not be converted to string in /in/YlXPP:-1 Stack trace: #0 /in/YlXPP(-1): array_diff() #1 {main}
Process exited with code 255.
Output for hhvm-3.19.2 - 3.21.3
Warning: in_array() expects parameter 2 to be an array or collection in /in/YlXPP on line 19 bool(false) Fatal error: Uncaught Error: Object of class stdClass could not be converted to string in /in/YlXPP:20 Stack trace: #0 /in/YlXPP(20): array_diff() #1 {main}
Process exited with code 255.
Output for hhvm-3.18.5
Warning: in_array() expects parameter 2 to be an array or collection in /in/YlXPP on line -1 bool(false) Fatal error: Uncaught Error: Object of class stdClass could not be converted to string in /in/YlXPP:-1 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.15.4 - 3.18.4
Warning: in_array() expects parameter 2 to be an array or collection in /in/YlXPP on line 19 bool(false) Fatal error: Uncaught Error: Object of class stdClass could not be converted to string in /in/YlXPP:20 Stack trace: #0 {main}
Process exited with code 255.