3v4l.org

run code in 300+ PHP versions simultaneously
<?php function iterator() { for ($i = 1; $i <= 10; $i++) { //echo 'pre it:' . $i . PHP_EOL; $res = (yield $i); //var_dump($res); } } $generator = iterator(); $generator->throw(new Exception('your mum')); //$generator->getOrigFuncName(); //$generator->getCalledClass(); foreach ($generator as $val){ echo $val . PHP_EOL; //$generator->send('hi'); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/cWcXN
function name:  (null)
number of ops:  16
compiled vars:  !0 = $generator, !1 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'iterator'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   14     3        INIT_METHOD_CALL                                         !0, 'throw'
          4        NEW                                              $4      'Exception'
          5        SEND_VAL_EX                                              'your+mum'
          6        DO_FCALL                                      0          
          7        SEND_VAR_NO_REF_EX                                       $4
          8        DO_FCALL                                      0          
   17     9      > FE_RESET_R                                       $7      !0, ->14
         10    > > FE_FETCH_R                                               $7, !1, ->14
   18    11    >   CONCAT                                           ~8      !1, '%0A'
         12        ECHO                                                     ~8
   17    13      > JMP                                                      ->10
         14    >   FE_FREE                                                  $7
   20    15      > RETURN                                                   1

Function iterator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 3
Branch analysis from position: 8
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 3
Branch analysis from position: 8
Branch analysis from position: 3
filename:       /in/cWcXN
function name:  iterator
number of ops:  9
compiled vars:  !0 = $i, !1 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   GENERATOR_CREATE                                         
    5     1        ASSIGN                                                   !0, 1
          2      > JMP                                                      ->6
    8     3    >   YIELD                                            $3      !0
          4        ASSIGN                                                   !1, $3
    5     5        PRE_INC                                                  !0
          6    >   IS_SMALLER_OR_EQUAL                                      !0, 10
          7      > JMPNZ                                                    ~6, ->3
   11     8    > > GENERATOR_RETURN                                         

End of function iterator

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.22 ms | 1398 KiB | 14 Q