3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $request_uri = parse_url( '/test/path/to/something', PHP_URL_PATH ); $uri_parts = explode( '/', trim( $request_uri, '/' ) ); $levels = array(); for ( $i = $uri_parts - 2; $i > 0; --$i ) { $levels[] = '/' . join( '/', array_slice( $uri_parts, 0, $i ) ) . '/'; } var_dump( $levels );
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Unsupported operand types in /in/PC5En:7 Stack trace: #0 {main} thrown in /in/PC5En on line 7
Process exited with code 255.
Output for 5.3.19 - 5.6.28
Fatal error: Unsupported operand types in /in/PC5En on line 7
Process exited with code 255.