3v4l.org

run code in 300+ PHP versions simultaneously
<?php function AddInTheMiddle($start, $where, $what){ $arr = explode("/", $what); $str = implode("/", array_splice($arr,$start,$where)) . '/xxx/' . implode("/", $arr);; return $str; } $str = 'solutions-en/rail-technologies/track-components/name-of-product'; $str = AddInTheMiddle(1, 2, $str); echo $str;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/m98io
function name:  (null)
number of ops:  9
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, 'solutions-en%2Frail-technologies%2Ftrack-components%2Fname-of-product'
   11     1        INIT_FCALL                                               'addinthemiddle'
          2        SEND_VAL                                                 1
          3        SEND_VAL                                                 2
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $2      
          6        ASSIGN                                                   !0, $2
   12     7        ECHO                                                     !0
   13     8      > RETURN                                                   1

Function addinthemiddle:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/m98io
function name:  AddInTheMiddle
number of ops:  26
compiled vars:  !0 = $start, !1 = $where, !2 = $what, !3 = $arr, !4 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    4     3        INIT_FCALL                                               'explode'
          4        SEND_VAL                                                 '%2F'
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !3, $5
    5     8        INIT_FCALL                                               'implode'
          9        SEND_VAL                                                 '%2F'
         10        INIT_FCALL                                               'array_splice'
         11        SEND_REF                                                 !3
         12        SEND_VAR                                                 !0
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $7      
         15        SEND_VAR                                                 $7
         16        DO_ICALL                                         $8      
         17        CONCAT                                           ~9      $8, '%2Fxxx%2F'
         18        INIT_FCALL                                               'implode'
         19        SEND_VAL                                                 '%2F'
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                         $10     
         22        CONCAT                                           ~11     ~9, $10
         23        ASSIGN                                                   !4, ~11
    7    24      > RETURN                                                   !4
    8    25*     > RETURN                                                   null

End of function addinthemiddle

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.3 ms | 1399 KiB | 20 Q