3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'http://localhost/new-123-rugby/competition.php?croncode=12345678'; $array = explode('/', $string); array_pop($array); // ignore the returned value, we don't need it echo(implode('/', $array).'/'); // join the pieces back, add the last '/'

preferences:
45.62 ms | 402 KiB | 5 Q