3v4l.org

run code in 300+ PHP versions simultaneously
<?php $vars=array( '^hello', 123, false, 1.23, ); foreach($vars as $var) { echo $var, ' => ', ($var[0]=='^') ? substr($var,1) : 'false', PHP_EOL; }
Output for 8.3.0 - 8.3.4
^hello => hello 123 => Warning: Trying to access array offset on int in /in/vIr4J on line 12 false => Warning: Trying to access array offset on false in /in/vIr4J on line 12 false 1.23 => Warning: Trying to access array offset on float in /in/vIr4J on line 12 false
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17
^hello => hello 123 => Warning: Trying to access array offset on value of type int in /in/vIr4J on line 12 false => Warning: Trying to access array offset on value of type bool in /in/vIr4J on line 12 false 1.23 => Warning: Trying to access array offset on value of type float in /in/vIr4J on line 12 false
Output for 7.4.0 - 7.4.33
^hello => hello 123 => Notice: Trying to access array offset on value of type int in /in/vIr4J on line 12 false => Notice: Trying to access array offset on value of type bool in /in/vIr4J on line 12 false 1.23 => Notice: Trying to access array offset on value of type float in /in/vIr4J on line 12 false
Output for 4.3.10 - 4.3.11, 4.4.0 - 4.4.9, 5.0.2 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.17 - 7.2.33, 7.3.0 - 7.3.33
^hello => hello 123 => false => false 1.23 => false
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
^hello => hello Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/vIr4J on line 12 PHP_EOL123 => false Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/vIr4J on line 12 PHP_EOL => false Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/vIr4J on line 12 PHP_EOL1.23 => false Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/vIr4J on line 12 PHP_EOL

preferences:
263.07 ms | 402 KiB | 377 Q