3v4l.org

run code in 300+ PHP versions simultaneously
<?php $file = new SplTempFileObject(); for ($i = 0; $i < 100; $i++) { $file->fwrite("Foo $i\n"); } $file->seek(50); echo json_encode(array( array('triggerNext' => $file->next(), 'line' => $file->key(), 'contents' => trim($file->current())), array('triggerNext' => $file->next(), 'line' => $file->key(), 'contents' => trim($file->current())), array('triggerNext' => $file->next(), 'line' => $file->key(), 'contents' => trim($file->current())), ), JSON_PRETTY_PRINT);
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/s4ZKA
function name:  (null)
number of ops:  62
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+'
          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
    9    14    >   INIT_METHOD_CALL                                         !0, 'seek'
         15        SEND_VAL_EX                                              50
         16        DO_FCALL                                      0          
   11    17        INIT_FCALL                                               'json_encode'
   12    18        INIT_METHOD_CALL                                         !0, 'next'
         19        DO_FCALL                                      0  $13     
         20        INIT_ARRAY                                       ~14     $13, 'triggerNext'
         21        INIT_METHOD_CALL                                         !0, 'key'
         22        DO_FCALL                                      0  $15     
         23        ADD_ARRAY_ELEMENT                                ~14     $15, 'line'
         24        INIT_FCALL                                               'trim'
         25        INIT_METHOD_CALL                                         !0, 'current'
         26        DO_FCALL                                      0  $16     
         27        SEND_VAR                                                 $16
         28        DO_ICALL                                         $17     
         29        ADD_ARRAY_ELEMENT                                ~14     $17, 'contents'
         30        INIT_ARRAY                                       ~18     ~14
   13    31        INIT_METHOD_CALL                                         !0, 'next'
         32        DO_FCALL                                      0  $19     
         33        INIT_ARRAY                                       ~20     $19, 'triggerNext'
         34        INIT_METHOD_CALL                                         !0, 'key'
         35        DO_FCALL                                      0  $21     
         36        ADD_ARRAY_ELEMENT                                ~20     $21, 'line'
         37        INIT_FCALL                                               'trim'
         38        INIT_METHOD_CALL                                         !0, 'current'
         39        DO_FCALL                                      0  $22     
         40        SEND_VAR                                                 $22
         41        DO_ICALL                                         $23     
         42        ADD_ARRAY_ELEMENT                                ~20     $23, 'contents'
         43        ADD_ARRAY_ELEMENT                                ~18     ~20
   14    44        INIT_METHOD_CALL                                         !0, 'next'
         45        DO_FCALL                                      0  $24     
         46        INIT_ARRAY                                       ~25     $24, 'triggerNext'
         47        INIT_METHOD_CALL                                         !0, 'key'
         48        DO_FCALL                                      0  $26     
         49        ADD_ARRAY_ELEMENT                                ~25     $26, 'line'
         50        INIT_FCALL                                               'trim'
         51        INIT_METHOD_CALL                                         !0, 'current'
         52        DO_FCALL                                      0  $27     
         53        SEND_VAR                                                 $27
         54        DO_ICALL                                         $28     
         55        ADD_ARRAY_ELEMENT                                ~25     $28, 'contents'
         56        ADD_ARRAY_ELEMENT                                ~18     ~25
         57        SEND_VAL                                                 ~18
   15    58        SEND_VAL                                                 128
         59        DO_ICALL                                         $29     
         60        ECHO                                                     $29
         61      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.4 ms | 1405 KiB | 17 Q