3v4l.org

run code in 300+ PHP versions simultaneously
<?php $segments1 = ["foo", "bar", "0", "", FALSE, 0, NULL]; $segments2 = array_filter($segments1, function (string $segment) { return $segment !== ''; }); var_export([$segments1, $segments2]);
Output for 8.2.0 - 8.2.24, 8.3.0 - 8.3.12
Fatal error: Uncaught TypeError: {closure}(): Argument #1 ($segment) must be of type string, null given in /in/fC7d8:4 Stack trace: #0 [internal function]: {closure}(NULL) #1 /in/fC7d8(4): array_filter(Array, Object(Closure)) #2 {main} thrown in /in/fC7d8 on line 4
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.30
Fatal error: Uncaught TypeError: {closure}(): Argument #1 ($segment) must be of type string, null given in /in/fC7d8:4 Stack trace: #0 [internal function]: {closure}(NULL) #1 /in/fC7d8(6): array_filter(Array, Object(Closure)) #2 {main} thrown in /in/fC7d8 on line 4
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: Argument 1 passed to {closure}() must be of the type string, null given in /in/fC7d8:4 Stack trace: #0 [internal function]: {closure}(NULL) #1 /in/fC7d8(6): array_filter(Array, Object(Closure)) #2 {main} thrown in /in/fC7d8 on line 4
Process exited with code 255.

preferences:
80.37 ms | 409 KiB | 5 Q