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"; $dir = '/usr/local/etc/'; $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/4uTu2
function name:  (null)
number of ops:  49
compiled vars:  !0 = $myfile, !1 = $txt, !2 = $dir, !3 = $files1, !4 = $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                                         $5      
          4        ASSIGN                                           ~6      !0, $5
          5      > JMPNZ_EX                                         ~6      ~6, ->8
          6    > > EXIT                                                     'Unable+to+open+file%21'
          7*       BOOL                                             ~6      <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                                         $12     
         23        CONCAT                                           ~13     $12, '%0A'
         24        ECHO                                                     ~13
   13    25        INIT_FCALL                                               'chdir'
         26        SEND_VAL                                                 '%2Ftmp'
         27        DO_ICALL                                                 
   16    28        INIT_FCALL                                               'getcwd'
         29        DO_ICALL                                         $15     
         30        CONCAT                                           ~16     $15, '%0A'
         31        ECHO                                                     ~16
   18    32        ASSIGN                                                   !2, '%2Fusr%2Flocal%2Fetc%2F'
   19    33        INIT_FCALL                                               'scandir'
         34        SEND_VAR                                                 !2
         35        DO_ICALL                                         $18     
         36        ASSIGN                                                   !3, $18
   20    37        INIT_FCALL                                               'scandir'
         38        SEND_VAR                                                 !2
         39        SEND_VAL                                                 1
         40        DO_ICALL                                         $20     
         41        ASSIGN                                                   !4, $20
   22    42        INIT_FCALL                                               'print_r'
         43        SEND_VAR                                                 !3
         44        DO_ICALL                                                 
   23    45        INIT_FCALL                                               'print_r'
         46        SEND_VAR                                                 !4
         47        DO_ICALL                                                 
         48      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.07 ms | 1400 KiB | 27 Q