3v4l.org

run code in 200+ PHP versions simultaneously
<?php function check($players1, $confirm1, $players2, $confirm2){ if ($players1 === NULL and $confirm1 === 0) { return 1; } elseif ($players1 !== NULL and $confirm1 === 1 and $players2 === NULL and $confirm2 === 0) { return 2; } else { return 3; } } $tests = [ [null, 0, null, null], [1,1, null, 0], [1, null, null, null], [1,1,1,1], ]; foreach($tests as $test){ var_dump(check(...$test)); }
based on ZZPD8
Output for 7.2.0 - 7.4.1
int(1) int(2) int(3) int(3)