3v4l.org

run code in 300+ PHP versions simultaneously
<?php $txt = <<<TXT 1 Hello! 2 How 3 are 4 you? TXT; $file = new SplFileObject('php://memory', 'w+'); $file->fwrite($txt); echo 'Seeking line 1...', PHP_EOL; $file->seek(0); echo 'Position in the file: ', $file->ftell(), PHP_EOL; echo 'Rest of the file: ', PHP_EOL, $file->fread(5000); echo PHP_EOL, '-------------', PHP_EOL; echo 'Seeking line 2...', PHP_EOL; $file->seek(1); echo 'Position in the file: ', $file->ftell(), PHP_EOL; echo 'Rest of the file: ', PHP_EOL, $file->fread(5000);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O89dJ
function name:  (null)
number of ops:  45
compiled vars:  !0 = $txt, !1 = $file
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '1+Hello%21%0A2+How%0A3+are%0A4+you%3F'
   10     1        NEW                                              $3      'SplFileObject'
          2        SEND_VAL_EX                                              'php%3A%2F%2Fmemory'
          3        SEND_VAL_EX                                              'w%2B'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $3
   11     6        INIT_METHOD_CALL                                         !1, 'fwrite'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
   13     9        ECHO                                                     'Seeking+line+1...'
         10        ECHO                                                     '%0A'
   14    11        INIT_METHOD_CALL                                         !1, 'seek'
         12        SEND_VAL_EX                                              0
         13        DO_FCALL                                      0          
   15    14        ECHO                                                     'Position+in+the+file%3A+'
         15        INIT_METHOD_CALL                                         !1, 'ftell'
         16        DO_FCALL                                      0  $8      
         17        ECHO                                                     $8
         18        ECHO                                                     '%0A'
   16    19        ECHO                                                     'Rest+of+the+file%3A+'
         20        ECHO                                                     '%0A'
         21        INIT_METHOD_CALL                                         !1, 'fread'
         22        SEND_VAL_EX                                              5000
         23        DO_FCALL                                      0  $9      
         24        ECHO                                                     $9
   18    25        ECHO                                                     '%0A'
         26        ECHO                                                     '-------------'
         27        ECHO                                                     '%0A'
   20    28        ECHO                                                     'Seeking+line+2...'
         29        ECHO                                                     '%0A'
   21    30        INIT_METHOD_CALL                                         !1, 'seek'
         31        SEND_VAL_EX                                              1
         32        DO_FCALL                                      0          
   22    33        ECHO                                                     'Position+in+the+file%3A+'
         34        INIT_METHOD_CALL                                         !1, 'ftell'
         35        DO_FCALL                                      0  $11     
         36        ECHO                                                     $11
         37        ECHO                                                     '%0A'
   23    38        ECHO                                                     'Rest+of+the+file%3A+'
         39        ECHO                                                     '%0A'
         40        INIT_METHOD_CALL                                         !1, 'fread'
         41        SEND_VAL_EX                                              5000
         42        DO_FCALL                                      0  $12     
         43        ECHO                                                     $12
         44      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.54 ms | 1453 KiB | 13 Q