3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $bar; } $foo = new Foo; $arr = array("", " ", FALSE, TRUE, array(), NULL, "0", 0, 0.0, new stdClass, $foo, $foo->bar, "\0"); foreach($arr as $val){ settype($val, 'string') ? "TRUE" : "FALSE"; echo "\n"; }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: Array to string conversion in /in/tB1oi on line 7 Fatal error: Uncaught Error: Object of class stdClass could not be converted to string in /in/tB1oi:7 Stack trace: #0 /in/tB1oi(7): settype(Object(stdClass), 'string') #1 {main} thrown in /in/tB1oi on line 7
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Notice: Array to string conversion in /in/tB1oi on line 7 Fatal error: Uncaught Error: Object of class stdClass could not be converted to string in /in/tB1oi:7 Stack trace: #0 /in/tB1oi(7): settype('', 'string') #1 {main} thrown in /in/tB1oi on line 7
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Recoverable fatal error: Object of class stdClass could not be converted to string in /in/tB1oi on line 7
Process exited with code 255.
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.31
Notice: Array to string conversion in /in/tB1oi on line 7 Recoverable fatal error: Object of class stdClass could not be converted to string in /in/tB1oi on line 7
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20
Notice: Array to string conversion in /in/tB1oi on line 7 Catchable fatal error: Object of class stdClass could not be converted to string in /in/tB1oi on line 7
Process exited with code 255.

preferences:
221.81 ms | 402 KiB | 227 Q