3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a1 = ['a', 'b', null, 'd']; $a2 = ['a', 'b', 'c', 'd']; if (count(array_filter($a1)) < count($a1)) { echo '$a1 has at least one empty value'; } if (count(array_filter($a2)) < count($a2)) { echo '$a2 has at least one empty value'; }
Output for 5.4.15, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.14
$a1 has at least one empty value
Output for 5.2.5
Parse error: syntax error, unexpected '[' in /in/dkGPr on line 3
Process exited with code 255.
Output for 4.3.0
Parse error: parse error, unexpected '[' in /in/dkGPr on line 3
Process exited with code 255.

preferences:
130.84 ms | 408 KiB | 5 Q