3v4l.org

run code in 300+ PHP versions simultaneously
<?php //include('/etc/profile'); $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"; $server = $_SERVER['DOCUMENT_ROOT']; echo $server; $dir = '/usr/local/'; $files1 = scandir($dir); $files2 = scandir($dir, 1); print_r($files1); print_r($files2);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pOR9c
function name:  (null)
number of ops:  53
compiled vars:  !0 = $myfile, !1 = $txt, !2 = $server, !3 = $dir, !4 = $files1, !5 = $files2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'fopen'
          1        SEND_VAL                                                 '%2Ftmp%2Ftest.txt'
          2        SEND_VAL                                                 'w'
          3        DO_ICALL                                         $6      
          4        ASSIGN                                           ~7      !0, $6
          5      > JMPNZ_EX                                         ~7      ~7, ->8
          6    > > EXIT                                                     'Unable+to+open+file%21'
          7*       BOOL                                             ~7      <true>
    4     8    >   ASSIGN                                                   !1, 'John+Doe%0A'
    5     9        INIT_FCALL                                               'fwrite'
         10        SEND_VAR                                                 !0
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
    6    13        ASSIGN                                                   !1, 'Jane+Doe%0A'
    7    14        INIT_FCALL                                               'fwrite'
         15        SEND_VAR                                                 !0
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
    8    18        INIT_FCALL                                               'fclose'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                                 
   11    21        INIT_FCALL                                               'getcwd'
         22        DO_ICALL                                         $13     
         23        CONCAT                                           ~14     $13, '%0A'
         24        ECHO                                                     ~14
   13    25        INIT_FCALL                                               'chdir'
         26        SEND_VAL                                                 '%2Ftmp'
         27        DO_ICALL                                                 
   16    28        INIT_FCALL                                               'getcwd'
         29        DO_ICALL                                         $16     
         30        CONCAT                                           ~17     $16, '%0A'
         31        ECHO                                                     ~17
   18    32        FETCH_R                      global              ~18     '_SERVER'
         33        FETCH_DIM_R                                      ~19     ~18, 'DOCUMENT_ROOT'
         34        ASSIGN                                                   !2, ~19
   20    35        ECHO                                                     !2
   22    36        ASSIGN                                                   !3, '%2Fusr%2Flocal%2F'
   23    37        INIT_FCALL                                               'scandir'
         38        SEND_VAR                                                 !3
         39        DO_ICALL                                         $22     
         40        ASSIGN                                                   !4, $22
   24    41        INIT_FCALL                                               'scandir'
         42        SEND_VAR                                                 !3
         43        SEND_VAL                                                 1
         44        DO_ICALL                                         $24     
         45        ASSIGN                                                   !5, $24
   26    46        INIT_FCALL                                               'print_r'
         47        SEND_VAR                                                 !4
         48        DO_ICALL                                                 
   27    49        INIT_FCALL                                               'print_r'
         50        SEND_VAR                                                 !5
         51        DO_ICALL                                                 
         52      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.54 ms | 1400 KiB | 27 Q