3v4l.org

run code in 300+ PHP versions simultaneously
<?php function logger($filename) { $fh = fopen($filename, 'w'); while (true) { $line = yield; fwrite($fh, $line . PHP_EOL); } } $log = logger(__FILE__); $log->send('Hello world!');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IqJIb
function name:  (null)
number of ops:  8
compiled vars:  !0 = $log
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'logger'
          1        SEND_VAL                                                 '%2Fin%2FIqJIb'
          2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
   11     4        INIT_METHOD_CALL                                         !0, 'send'
          5        SEND_VAL_EX                                              'Hello+world%21'
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Function logger:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 8
Branch analysis from position: 16
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 8
Branch analysis from position: 16
Branch analysis from position: 8
filename:       /in/IqJIb
function name:  logger
number of ops:  17
compiled vars:  !0 = $filename, !1 = $fh, !2 = $line
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    4     2        INIT_FCALL                                               'fopen'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'w'
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !1, $3
    5     7      > JMP                                                      ->15
    6     8    >   YIELD                                            $5      
          9        ASSIGN                                                   !2, $5
    7    10        INIT_FCALL                                               'fwrite'
         11        SEND_VAR                                                 !1
         12        CONCAT                                           ~7      !2, '%0A'
         13        SEND_VAL                                                 ~7
         14        DO_ICALL                                                 
    5    15    > > JMPNZ                                                    <true>, ->8
    9    16    > > GENERATOR_RETURN                                         

End of function logger

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.21 ms | 1398 KiB | 18 Q