- implode: documentation ( source)
- explode: documentation ( source)
- array_pop: documentation ( source)
<?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 '/'