3v4l.org

run code in 500+ PHP versions simultaneously
<?php $a = '0'; $b = '1'; $b2 = 1; $b3 = true; $c = ''; $c2 = false; $c3 = null; $d = '-1'; $e = '2'; $f = 'abc'; function test($a) { if (!$a) { $a = 0; } if ($a != 1) { echo '1' . " "; } else { echo '0' . " "; } } function test2($a) { $a = (bool)$a; if (!$a) { echo '1' . "\n"; } else { echo '0' . "\n"; } } test($a);test2($a); test($b);test2($b); test($b2);test2($b2); test($b3);test2($b3); test($c);test2($c); test($c2);test2($c2); test($c3);test2($c3); test($d);test2($d); test($e);test2($e); test($f);test2($f);
Output for 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.36, 8.3.0 - 8.3.37, 8.4.1 - 8.4.28, 8.5.0 - 8.5.13, 8.6.0
1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 0 1 0

preferences:
61.54 ms | 1164 KiB | 6 Q