3v4l.org

run code in 300+ PHP versions simultaneously
<?php function makeRandomPath($dir, $ext) { do { $path = $dir."/".genRandomString().".".$ext; } while(file_exists($path)); return $path; } echo makeRandomPath(); function makeRandomPathFromFilename($dir, $fn) { $ext = pathinfo($fn, PATHINFO_EXTENSION); return makeRandomPath($dir, $ext); } echo makeRandomPathFromFilename();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uJBv6
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'makerandompath'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
   15     3        INIT_FCALL                                               'makerandompathfromfilename'
          4        DO_FCALL                                      0  $1      
          5        ECHO                                                     $1
          6      > RETURN                                                   1

Function makerandompath:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
filename:       /in/uJBv6
function name:  makeRandomPath
number of ops:  15
compiled vars:  !0 = $dir, !1 = $ext, !2 = $path
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2    >   CONCAT                                           ~3      !0, '%2F'
          3        INIT_FCALL_BY_NAME                                       'genRandomString'
          4        DO_FCALL                                      0  $4      
          5        CONCAT                                           ~5      ~3, $4
          6        CONCAT                                           ~6      ~5, '.'
          7        CONCAT                                           ~7      ~6, !1
          8        ASSIGN                                                   !2, ~7
    6     9        INIT_FCALL                                               'file_exists'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $9      
         12      > JMPNZ                                                    $9, ->2
    7    13    > > RETURN                                                   !2
    8    14*     > RETURN                                                   null

End of function makerandompath

Function makerandompathfromfilename:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uJBv6
function name:  makeRandomPathFromFilename
number of ops:  13
compiled vars:  !0 = $dir, !1 = $fn, !2 = $ext
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        INIT_FCALL                                               'pathinfo'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 4
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !2, $3
   13     7        INIT_FCALL                                               'makerandompath'
          8        SEND_VAR                                                 !0
          9        SEND_VAR                                                 !2
         10        DO_FCALL                                      0  $5      
         11      > RETURN                                                   $5
   14    12*     > RETURN                                                   null

End of function makerandompathfromfilename

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.46 ms | 1403 KiB | 20 Q