3v4l.org

run code in 300+ PHP versions simultaneously
<?php $path = '/a/b/c/d/e.f'; $matches = preg_split('/\/|\\\/', $path); $filename = $matches[count($matches) - 1]; $path = implode(DIRECTORY_SEPARATOR, $matches); if(strpos($filename, '.') !== -1) { $ext = substr($filename, strpos($filename, '.')); echo $ext; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 31
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/UIZgn
function name:  (null)
number of ops:  32
compiled vars:  !0 = $path, !1 = $matches, !2 = $filename, !3 = $ext
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2Fa%2Fb%2Fc%2Fd%2Fe.f'
    5     1        INIT_FCALL                                               'preg_split'
          2        SEND_VAL                                                 '%2F%5C%2F%7C%5C%5C%2F'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
    7     6        COUNT                                            ~7      !1
          7        SUB                                              ~8      ~7, 1
          8        FETCH_DIM_R                                      ~9      !1, ~8
          9        ASSIGN                                                   !2, ~9
    9    10        INIT_FCALL                                               'implode'
         11        SEND_VAL                                                 '%2F'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $11     
         14        ASSIGN                                                   !0, $11
   11    15        INIT_FCALL                                               'strpos'
         16        SEND_VAR                                                 !2
         17        SEND_VAL                                                 '.'
         18        DO_ICALL                                         $13     
         19        IS_NOT_IDENTICAL                                         $13, -1
         20      > JMPZ                                                     ~14, ->31
   12    21    >   INIT_FCALL                                               'substr'
         22        SEND_VAR                                                 !2
         23        INIT_FCALL                                               'strpos'
         24        SEND_VAR                                                 !2
         25        SEND_VAL                                                 '.'
         26        DO_ICALL                                         $15     
         27        SEND_VAR                                                 $15
         28        DO_ICALL                                         $16     
         29        ASSIGN                                                   !3, $16
   13    30        ECHO                                                     !3
   14    31    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.22 ms | 1396 KiB | 21 Q