3v4l.org

run code in 300+ PHP versions simultaneously
<html> <head> <title>PHP Test</title> </head> <body> <?PHP $filename = 'text.txt'; $somecontent = "My name is Chukwudi and this is my contribution \n"; // Let's check if file exists and writable. IF (IS_WRITABLE($filename)) { // opening $filename. // that's where $somecontent will go when we fwrite() it. IF (!$handle = FOPEN($filename, 'a')) { PRINT "Cannot open file ($filename)"; EXIT; } // Write $somecontent to text.txt file. IF (!FWRITE($handle, $somecontent)) { PRINT "Cannot write to file ($filename)"; EXIT; } PRINT "Success, wrote ($somecontent) to file ($filename)"; FCLOSE($handle); } ELSE { PRINT "The file $filename is not writable"; } ?> </body> </html>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 40
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 19
Branch analysis from position: 14
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 30
Branch analysis from position: 25
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zsgni
function name:  (null)
number of ops:  46
compiled vars:  !0 = $filename, !1 = $somecontent, !2 = $handle
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     '%3Chtml%3E%0A+%3Chead%3E%0A++%3Ctitle%3EPHP+Test%3C%2Ftitle%3E%0A+%3C%2Fhead%3E%0A%3Cbody%3E%0A%0A'
    9     1        ASSIGN                                                   !0, 'text.txt'
   10     2        ASSIGN                                                   !1, 'My+name+is+Chukwudi+and+this+is+my+contribution+%0A'
   13     3        INIT_FCALL                                               'is_writable'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6      > JMPZ                                                     $5, ->40
   17     7    >   INIT_FCALL                                               'fopen'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 'a'
         10        DO_ICALL                                         $6      
         11        ASSIGN                                           ~7      !2, $6
         12        BOOL_NOT                                         ~8      ~7
         13      > JMPZ                                                     ~8, ->19
   18    14    >   ROPE_INIT                                     3  ~10     'Cannot+open+file+%28'
         15        ROPE_ADD                                      1  ~10     ~10, !0
         16        ROPE_END                                      2  ~9      ~10, '%29'
         17        ECHO                                                     ~9
   19    18      > EXIT                                                     
   23    19    >   INIT_FCALL                                               'fwrite'
         20        SEND_VAR                                                 !2
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                         $12     
         23        BOOL_NOT                                         ~13     $12
         24      > JMPZ                                                     ~13, ->30
   24    25    >   ROPE_INIT                                     3  ~15     'Cannot+write+to+file+%28'
         26        ROPE_ADD                                      1  ~15     ~15, !0
         27        ROPE_END                                      2  ~14     ~15, '%29'
         28        ECHO                                                     ~14
   25    29      > EXIT                                                     
   28    30    >   ROPE_INIT                                     5  ~18     'Success%2C+wrote+%28'
         31        ROPE_ADD                                      1  ~18     ~18, !1
         32        ROPE_ADD                                      2  ~18     ~18, '%29+to+file+%28'
         33        ROPE_ADD                                      3  ~18     ~18, !0
         34        ROPE_END                                      4  ~17     ~18, '%29'
         35        ECHO                                                     ~17
   30    36        INIT_FCALL                                               'fclose'
         37        SEND_VAR                                                 !2
         38        DO_ICALL                                                 
         39      > JMP                                                      ->44
   33    40    >   ROPE_INIT                                     3  ~23     'The+file+'
         41        ROPE_ADD                                      1  ~23     ~23, !0
         42        ROPE_END                                      2  ~22     ~23, '+is+not+writable'
         43        ECHO                                                     ~22
   35    44    >   ECHO                                                     '++%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
   37    45      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.51 ms | 1400 KiB | 21 Q