3v4l.org

run code in 300+ PHP versions simultaneously
<?php function replaceFileName($input, $newFileName) { $info = pathInfo($input); return $info['dirname'] . DIRECTORY_SEPARATOR . $newFileName . '.' . $info['extension']; } $test = "/txt/txt/txt/txt.txt"; var_dump(replaceFileName($test, 'testing'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B192t
function name:  (null)
number of ops:  9
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, '%2Ftxt%2Ftxt%2Ftxt%2Ftxt.txt'
    9     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'replacefilename'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'testing'
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function replacefilename:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B192t
function name:  replaceFileName
number of ops:  14
compiled vars:  !0 = $input, !1 = $newFileName, !2 = $info
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'pathinfo'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !2, $3
    5     6        FETCH_DIM_R                                      ~5      !2, 'dirname'
          7        CONCAT                                           ~6      ~5, '%2F'
          8        CONCAT                                           ~7      ~6, !1
          9        CONCAT                                           ~8      ~7, '.'
         10        FETCH_DIM_R                                      ~9      !2, 'extension'
         11        CONCAT                                           ~10     ~8, ~9
         12      > RETURN                                                   ~10
    6    13*     > RETURN                                                   null

End of function replacefilename

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.86 ms | 943 KiB | 19 Q