3v4l.org

run code in 300+ PHP versions simultaneously
<?php $f = new SplFileObject('php://memory', 'r+'); assert($f instanceof Iterator); $f->fwrite("line 1"); $f->rewind(); assert($f->valid() === true); assert($f->eof() === false); assert($f->current() === "line 1"); //assert($f->valid() === true); // fails assert($f->eof() === true);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rcdPY
function name:  (null)
number of ops:  49
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $1      'SplFileObject'
          1        SEND_VAL_EX                                              'php%3A%2F%2Fmemory'
          2        SEND_VAL_EX                                              'r%2B'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
    4     5        ASSERT_CHECK                                             
          6        INIT_FCALL                                               'assert'
          7        INSTANCEOF                                       ~4      !0, 'Iterator'
          8        SEND_VAL                                                 ~4
          9        SEND_VAL                                                 'assert%28%24f+instanceof+Iterator%29'
         10        DO_ICALL                                                 
    5    11        INIT_METHOD_CALL                                         !0, 'fwrite'
         12        SEND_VAL_EX                                              'line+1'
         13        DO_FCALL                                      0          
    6    14        INIT_METHOD_CALL                                         !0, 'rewind'
         15        DO_FCALL                                      0          
    7    16        ASSERT_CHECK                                             
         17        INIT_FCALL                                               'assert'
         18        INIT_METHOD_CALL                                         !0, 'valid'
         19        DO_FCALL                                      0  $8      
         20        TYPE_CHECK                                    8  ~9      $8
         21        SEND_VAL                                                 ~9
         22        SEND_VAL                                                 'assert%28%24f-%3Evalid%28%29+%3D%3D%3D+true%29'
         23        DO_ICALL                                                 
    8    24        ASSERT_CHECK                                             
         25        INIT_FCALL                                               'assert'
         26        INIT_METHOD_CALL                                         !0, 'eof'
         27        DO_FCALL                                      0  $11     
         28        TYPE_CHECK                                    4  ~12     $11
         29        SEND_VAL                                                 ~12
         30        SEND_VAL                                                 'assert%28%24f-%3Eeof%28%29+%3D%3D%3D+false%29'
         31        DO_ICALL                                                 
    9    32        ASSERT_CHECK                                             
         33        INIT_FCALL                                               'assert'
         34        INIT_METHOD_CALL                                         !0, 'current'
         35        DO_FCALL                                      0  $14     
         36        IS_IDENTICAL                                     ~15     $14, 'line+1'
         37        SEND_VAL                                                 ~15
         38        SEND_VAL                                                 'assert%28%24f-%3Ecurrent%28%29+%3D%3D%3D+%27line+1%27%29'
         39        DO_ICALL                                                 
   11    40        ASSERT_CHECK                                             
         41        INIT_FCALL                                               'assert'
         42        INIT_METHOD_CALL                                         !0, 'eof'
         43        DO_FCALL                                      0  $17     
         44        TYPE_CHECK                                    8  ~18     $17
         45        SEND_VAL                                                 ~18
         46        SEND_VAL                                                 'assert%28%24f-%3Eeof%28%29+%3D%3D%3D+true%29'
         47        DO_ICALL                                                 
         48      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.53 ms | 1400 KiB | 15 Q