3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $found = null; $route = '/_ticket/show/xxx'; foreach ( explode( '/', trim( $route, '/' ) ) as $part => $r ) { $uscore = strpos( $r, '_' ); $times = substr_count( $r, '_' ); if ( 1 != $times || 0 != $uscore ) { continue; } $found = $part; break; } var_dump( $found ); /*if ( null !== $found ) { $parts = explode( '/', trim( $route, '/' ) ); $parts }*/
Output for 4.3.0 - 7.1.0
int(0)