3v4l.org

run code in 300+ PHP versions simultaneously
<?php include('/etc/passwd'); $myfile = fopen("/tmp/test.txt", "w") or die("Unable to open file!"); $txt = "John Doe\n"; fwrite($myfile, $txt); $txt = "Jane Doe\n"; fwrite($myfile, $txt); fclose($myfile); // current directory echo getcwd() . "\n"; chdir('/tmp'); // current directory echo getcwd() . "\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iJrAj
function name:  (null)
number of ops:  34
compiled vars:  !0 = $myfile, !1 = $txt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INCLUDE_OR_EVAL                                          '%2Fetc%2Fpasswd', INCLUDE
    3     1        INIT_FCALL                                               'fopen'
          2        SEND_VAL                                                 '%2Ftmp%2Ftest.txt'
          3        SEND_VAL                                                 'w'
          4        DO_ICALL                                         $3      
          5        ASSIGN                                           ~4      !0, $3
          6      > JMPNZ_EX                                         ~4      ~4, ->9
          7    > > EXIT                                                     'Unable+to+open+file%21'
          8*       BOOL                                             ~4      <true>
    4     9    >   ASSIGN                                                   !1, 'John+Doe%0A'
    5    10        INIT_FCALL                                               'fwrite'
         11        SEND_VAR                                                 !0
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                                 
    6    14        ASSIGN                                                   !1, 'Jane+Doe%0A'
    7    15        INIT_FCALL                                               'fwrite'
         16        SEND_VAR                                                 !0
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                                 
    8    19        INIT_FCALL                                               'fclose'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                                 
   11    22        INIT_FCALL                                               'getcwd'
         23        DO_ICALL                                         $10     
         24        CONCAT                                           ~11     $10, '%0A'
         25        ECHO                                                     ~11
   13    26        INIT_FCALL                                               'chdir'
         27        SEND_VAL                                                 '%2Ftmp'
         28        DO_ICALL                                                 
   16    29        INIT_FCALL                                               'getcwd'
         30        DO_ICALL                                         $13     
         31        CONCAT                                           ~14     $13, '%0A'
         32        ECHO                                                     ~14
         33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.45 ms | 1396 KiB | 23 Q