3v4l.org

run code in 500+ PHP versions simultaneously
<?php $file = new \SplTempFileObject(); for ($i = 0; $i < 100; $i++) { $file->fwrite("Foo\t$i\n"); } // Puts the internal pointer at the start of line index 50 (0-based indexing) $file->seek(50); // Read the internal pointer value = 50 var_dump($file->key()); // Read the next available line (which is line at index 50) var_dump($file->fgets()); // Read the internal pointer value = 50 (end of the line now) var_dump($file->key()); // Read the next available line (which is line at index 51 as there's nothing more on line 50) var_dump($file->fgets()); // Read the internal pointer value = 51 (end of the line) var_dump($file->key());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 5
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 5
Branch analysis from position: 14
Branch analysis from position: 5
filename:       /in/m5Dhn
function name:  (null)
number of ops:  43
compiled vars:  !0 = $file, !1 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   NEW                                                  $2      'SplTempFileObject'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
    5     3        ASSIGN                                                       !1, 0
          4      > JMP                                                          ->12
    6     5    >   INIT_METHOD_CALL                                             !0, 'fwrite'
          6        ROPE_INIT                                         3  ~7      'Foo%09'
          7        ROPE_ADD                                          1  ~7      ~7, !1
          8        ROPE_END                                          2  ~6      ~7, '%0A'
          9        SEND_VAL_EX                                                  ~6
         10        DO_FCALL                                          0          
    5    11        PRE_INC                                                      !1
         12    >   IS_SMALLER                                                   !1, 100
         13      > JMPNZ                                                        ~11, ->5
   10    14    >   INIT_METHOD_CALL                                             !0, 'seek'
         15        SEND_VAL_EX                                                  50
         16        DO_FCALL                                          0          
   13    17        INIT_FCALL                                                   'var_dump'
         18        INIT_METHOD_CALL                                             !0, 'key'
         19        DO_FCALL                                          0  $13     
         20        SEND_VAR                                                     $13
         21        DO_ICALL                                                     
   15    22        INIT_FCALL                                                   'var_dump'
         23        INIT_METHOD_CALL                                             !0, 'fgets'
         24        DO_FCALL                                          0  $15     
         25        SEND_VAR                                                     $15
         26        DO_ICALL                                                     
   17    27        INIT_FCALL                                                   'var_dump'
         28        INIT_METHOD_CALL                                             !0, 'key'
         29        DO_FCALL                                          0  $17     
         30        SEND_VAR                                                     $17
         31        DO_ICALL                                                     
   19    32        INIT_FCALL                                                   'var_dump'
         33        INIT_METHOD_CALL                                             !0, 'fgets'
         34        DO_FCALL                                          0  $19     
         35        SEND_VAR                                                     $19
         36        DO_ICALL                                                     
   21    37        INIT_FCALL                                                   'var_dump'
         38        INIT_METHOD_CALL                                             !0, 'key'
         39        DO_FCALL                                          0  $21     
         40        SEND_VAR                                                     $21
         41        DO_ICALL                                                     
         42      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
153.92 ms | 1434 KiB | 9 Q