3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = "foo"; $stream = fopen('php://memory', 'r+'); fwrite($stream, $data); fseek($stream, 0); if ($data !== fread($stream, strlen($data)+1)) { throw new \Exception("Invalid data"); } if (strlen($data) !== ftell($stream)) { throw new \Exception("Invalid tell"); } if (feof($stream) !== true) { throw new \Exception("Invalid eof"); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 26
Branch analysis from position: 22
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 36
Branch analysis from position: 32
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 45
Branch analysis from position: 41
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/frnT2
function name:  (null)
number of ops:  46
compiled vars:  !0 = $data, !1 = $stream
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'foo'
    4     1        INIT_FCALL                                               'fopen'
          2        SEND_VAL                                                 'php%3A%2F%2Fmemory'
          3        SEND_VAL                                                 'r%2B'
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !1, $3
    5     6        INIT_FCALL                                               'fwrite'
          7        SEND_VAR                                                 !1
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
    6    10        INIT_FCALL                                               'fseek'
         11        SEND_VAR                                                 !1
         12        SEND_VAL                                                 0
         13        DO_ICALL                                                 
    7    14        INIT_FCALL                                               'fread'
         15        SEND_VAR                                                 !1
         16        STRLEN                                           ~7      !0
         17        ADD                                              ~8      ~7, 1
         18        SEND_VAL                                                 ~8
         19        DO_ICALL                                         $9      
         20        IS_NOT_IDENTICAL                                         !0, $9
         21      > JMPZ                                                     ~10, ->26
    8    22    >   NEW                                              $11     'Exception'
         23        SEND_VAL_EX                                              'Invalid+data'
         24        DO_FCALL                                      0          
         25      > THROW                                         0          $11
   10    26    >   STRLEN                                           ~13     !0
         27        INIT_FCALL                                               'ftell'
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                         $14     
         30        IS_NOT_IDENTICAL                                         $14, ~13
         31      > JMPZ                                                     ~15, ->36
   11    32    >   NEW                                              $16     'Exception'
         33        SEND_VAL_EX                                              'Invalid+tell'
         34        DO_FCALL                                      0          
         35      > THROW                                         0          $16
   13    36    >   INIT_FCALL                                               'feof'
         37        SEND_VAR                                                 !1
         38        DO_ICALL                                         $18     
         39        TYPE_CHECK                                  1014          $18
         40      > JMPZ                                                     ~19, ->45
   14    41    >   NEW                                              $20     'Exception'
         42        SEND_VAL_EX                                              'Invalid+eof'
         43        DO_FCALL                                      0          
         44      > THROW                                         0          $20
   15    45    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.22 ms | 1392 KiB | 25 Q