3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = "http://www.foo.com/parentfoo/childfoo/"; $last = strrpos($url, '/'); if ($last === false) { return false; } $next_to_last = strrpos($url, '/', $last - strlen($url) - 1); echo $var1 = substr_replace($url,"",$last); $var2 = substr_replace($var1,"#",$next_to_last);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b7Osk
function name:  (null)
number of ops:  32
compiled vars:  !0 = $url, !1 = $last, !2 = $next_to_last, !3 = $var1, !4 = $var2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2Fwww.foo.com%2Fparentfoo%2Fchildfoo%2F'
    3     1        INIT_FCALL                                               'strrpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%2F'
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !1, $6
    4     6        TYPE_CHECK                                    4          !1
          7      > JMPZ                                                     ~8, ->9
    5     8    > > RETURN                                                   <false>
    9     9    >   INIT_FCALL                                               'strrpos'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 '%2F'
         12        STRLEN                                           ~9      !0
         13        SUB                                              ~10     !1, ~9
         14        SUB                                              ~11     ~10, 1
         15        SEND_VAL                                                 ~11
         16        DO_ICALL                                         $12     
         17        ASSIGN                                                   !2, $12
   11    18        INIT_FCALL                                               'substr_replace'
         19        SEND_VAR                                                 !0
         20        SEND_VAL                                                 ''
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                         $14     
         23        ASSIGN                                           ~15     !3, $14
         24        ECHO                                                     ~15
   12    25        INIT_FCALL                                               'substr_replace'
         26        SEND_VAR                                                 !3
         27        SEND_VAL                                                 '%23'
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                         $16     
         30        ASSIGN                                                   !4, $16
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.02 ms | 1396 KiB | 17 Q