3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = 'http://localhost/new-123-rugby/competition.php?croncode=12345678'; $array = explode('/', $string); $array[count($array) - 1] = ''; // empty the last component echo(implode('/', $array)); // join the pieces back
based on 56Mp7
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/LVJDY
function name:  (null)
number of ops:  18
compiled vars:  !0 = $string, !1 = $array
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   4     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2Flocalhost%2Fnew-123-rugby%2Fcompetition.php%3Fcroncode%3D12345678'
   5     1        INIT_FCALL                                               'explode'
         2        SEND_VAL                                                 '%2F'
         3        SEND_VAR                                                 !0
         4        DO_ICALL                                         $3      
         5        ASSIGN                                                   !1, $3
   6     6        INIT_FCALL                                               'count'
         7        SEND_VAR                                                 !1
         8        DO_ICALL                                         $5      
         9        SUB                                              ~6      $5, 1
        10        ASSIGN_DIM                                               !1, ~6
        11        OP_DATA                                                  ''
   7    12        INIT_FCALL                                               'implode'
        13        SEND_VAL                                                 '%2F'
        14        SEND_VAR                                                 !1
        15        DO_ICALL                                         $8      
        16        ECHO                                                     $8
        17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.3.0