3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL & ~E_NOTICE); $data = [ 'none' => ['x'=>false,'y'=>false], 'only x' => ['x'=>true, 'y'=>false], 'only y' => ['x'=>false,'y'=>true ], ]; foreach ($data as $k => $v) { if ($v['x']) { $x = true; } if ($v['y']) { $y = true; } if ($x && $y) { var_dump('x && y when k = '. $k); } }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Warning: Undefined variable $x in /in/BkeL1 on line 23 Warning: Undefined variable $y in /in/BkeL1 on line 23 string(22) "x && y when k = only y"
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
string(22) "x && y when k = only y"

preferences:
112.24 ms | 1585 KiB | 4 Q