3v4l.org

run code in 300+ 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)); }

preferences:
49.7 ms | 402 KiB | 5 Q