3v4l.org

run code in 300+ PHP versions simultaneously
<?php $urlPath = parse_url('http://tvil.ru/city/gelendzhik/hotels/341229/', PHP_URL_PATH); $pathParts = explode('/', $urlPath); $pathParts = array_filter($old_array, function($element) { return !empty($element); }); var_dump($pathParts);
Output for 8.2.0 - 8.2.20, 8.3.0 - 8.3.8
Warning: Undefined variable $old_array in /in/l2h88 on line 5 Fatal error: Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in /in/l2h88:5 Stack trace: #0 /in/l2h88(5): array_filter(NULL, Object(Closure)) #1 {main} thrown in /in/l2h88 on line 5
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.29
Warning: Undefined variable $old_array in /in/l2h88 on line 5 Fatal error: Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in /in/l2h88:7 Stack trace: #0 /in/l2h88(7): array_filter(NULL, Object(Closure)) #1 {main} thrown in /in/l2h88 on line 7
Process exited with code 255.
Output for 5.6.0 - 5.6.23, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined variable: old_array in /in/l2h88 on line 5 Warning: array_filter() expects parameter 1 to be array, null given in /in/l2h88 on line 7 NULL
Output for 7.3.32 - 7.3.33
Warning: array_filter() expects parameter 1 to be array, null given in /in/l2h88 on line 7 NULL

preferences:
180.79 ms | 402 KiB | 232 Q