3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo(){ // sys_get_temp_dir is only available since PHP 5.2.1 // http://php.net/manual/en/function.sys-get-temp-dir.php#94119 if ( !function_exists('sys_get_temp_dir')) { if ($temp = getenv('TMP') ) { if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); } } if ($temp = getenv('TEMP') ) { if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); } } if ($temp = getenv('TMPDIR') ) { if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); } } // trick for creating a file in system's temporary dir // without knowing the path of the system's temporary dir $temp = tempnam(__FILE__, ''); if (file_exists($temp)) { unlink($temp); return realpath(dirname($temp)); } return null; } // use ordinary built-in PHP function // There should be no problem with the 5.2.4 Suhosin realpath() bug, because this line should only // be called if we're running 5.2.1 or earlier return realpath(sys_get_temp_dir()); } echo foo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aC7do
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   INIT_FCALL                                               'foo'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
          3      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 76
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 22
Branch analysis from position: 10
2 jumps found. (Code = 46) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 39
Branch analysis from position: 27
2 jumps found. (Code = 46) Position 1 = 30, Position 2 = 34
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 39
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 56
Branch analysis from position: 44
2 jumps found. (Code = 46) Position 1 = 47, Position 2 = 51
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 56
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 56
2 jumps found. (Code = 43) Position 1 = 65, Position 2 = 75
Branch analysis from position: 65
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 75
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
Branch analysis from position: 56
Branch analysis from position: 34
Branch analysis from position: 39
Branch analysis from position: 17
Branch analysis from position: 22
Branch analysis from position: 76
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aC7do
function name:  foo
number of ops:  83
compiled vars:  !0 = $temp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'function_exists'
          1        SEND_VAL                                                 'sys_get_temp_dir'
          2        DO_ICALL                                         $1      
          3        BOOL_NOT                                         ~2      $1
          4      > JMPZ                                                     ~2, ->76
    6     5    >   INIT_FCALL                                               'getenv'
          6        SEND_VAL                                                 'TMP'
          7        DO_ICALL                                         $3      
          8        ASSIGN                                           ~4      !0, $3
          9      > JMPZ                                                     ~4, ->22
    7    10    >   ISSET_ISEMPTY_CV                                 ~5      !0
         11        BOOL_NOT                                         ~6      ~5
         12      > JMPZ_EX                                          ~6      ~6, ->17
         13    >   INIT_FCALL                                               'file_exists'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $7      
         16        BOOL                                             ~6      $7
         17    > > JMPZ                                                     ~6, ->22
         18    >   INIT_FCALL                                               'realpath'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                         $8      
         21      > RETURN                                                   $8
    9    22    >   INIT_FCALL                                               'getenv'
         23        SEND_VAL                                                 'TEMP'
         24        DO_ICALL                                         $9      
         25        ASSIGN                                           ~10     !0, $9
         26      > JMPZ                                                     ~10, ->39
   10    27    >   ISSET_ISEMPTY_CV                                 ~11     !0
         28        BOOL_NOT                                         ~12     ~11
         29      > JMPZ_EX                                          ~12     ~12, ->34
         30    >   INIT_FCALL                                               'file_exists'
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                         $13     
         33        BOOL                                             ~12     $13
         34    > > JMPZ                                                     ~12, ->39
         35    >   INIT_FCALL                                               'realpath'
         36        SEND_VAR                                                 !0
         37        DO_ICALL                                         $14     
         38      > RETURN                                                   $14
   12    39    >   INIT_FCALL                                               'getenv'
         40        SEND_VAL                                                 'TMPDIR'
         41        DO_ICALL                                         $15     
         42        ASSIGN                                           ~16     !0, $15
         43      > JMPZ                                                     ~16, ->56
   13    44    >   ISSET_ISEMPTY_CV                                 ~17     !0
         45        BOOL_NOT                                         ~18     ~17
         46      > JMPZ_EX                                          ~18     ~18, ->51
         47    >   INIT_FCALL                                               'file_exists'
         48        SEND_VAR                                                 !0
         49        DO_ICALL                                         $19     
         50        BOOL                                             ~18     $19
         51    > > JMPZ                                                     ~18, ->56
         52    >   INIT_FCALL                                               'realpath'
         53        SEND_VAR                                                 !0
         54        DO_ICALL                                         $20     
         55      > RETURN                                                   $20
   18    56    >   INIT_FCALL                                               'tempnam'
         57        SEND_VAL                                                 '%2Fin%2FaC7do'
         58        SEND_VAL                                                 ''
         59        DO_ICALL                                         $21     
         60        ASSIGN                                                   !0, $21
   19    61        INIT_FCALL                                               'file_exists'
         62        SEND_VAR                                                 !0
         63        DO_ICALL                                         $23     
         64      > JMPZ                                                     $23, ->75
   20    65    >   INIT_FCALL                                               'unlink'
         66        SEND_VAR                                                 !0
         67        DO_ICALL                                                 
   21    68        INIT_FCALL                                               'realpath'
         69        INIT_FCALL                                               'dirname'
         70        SEND_VAR                                                 !0
         71        DO_ICALL                                         $25     
         72        SEND_VAR                                                 $25
         73        DO_ICALL                                         $26     
         74      > RETURN                                                   $26
   24    75    > > RETURN                                                   null
   30    76    >   INIT_FCALL                                               'realpath'
         77        INIT_FCALL                                               'sys_get_temp_dir'
         78        DO_ICALL                                         $27     
         79        SEND_VAR                                                 $27
         80        DO_ICALL                                         $28     
         81      > RETURN                                                   $28
   31    82*     > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.34 ms | 1398 KiB | 30 Q