3v4l.org

run code in 300+ PHP versions simultaneously
<?php $g = function () { yield 1; yield 1; }; $gen = $g(); $refl = new ReflectionGenerator($gen); echo "Line: ", $refl->getExecutingLine(), PHP_EOL; $value = $gen->current(); var_dump($value); echo "Line: ", $refl->getExecutingLine(), PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hskOD
function name:  (null)
number of ops:  26
compiled vars:  !0 = $g, !1 = $gen, !2 = $refl, !3 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FhskOD%3A3%240'
          1        ASSIGN                                                   !0, ~4
   12     2        INIT_DYNAMIC_CALL                                        !0
          3        DO_FCALL                                      0  $6      
          4        ASSIGN                                                   !1, $6
   13     5        NEW                                              $8      'ReflectionGenerator'
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $8
   15     9        ECHO                                                     'Line%3A+'
         10        INIT_METHOD_CALL                                         !2, 'getExecutingLine'
         11        DO_FCALL                                      0  $11     
         12        ECHO                                                     $11
         13        ECHO                                                     '%0A'
   17    14        INIT_METHOD_CALL                                         !1, 'current'
         15        DO_FCALL                                      0  $12     
         16        ASSIGN                                                   !3, $12
   18    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                                 
   20    20        ECHO                                                     'Line%3A+'
         21        INIT_METHOD_CALL                                         !2, 'getExecutingLine'
         22        DO_FCALL                                      0  $15     
         23        ECHO                                                     $15
         24        ECHO                                                     '%0A'
         25      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FhskOD%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/hskOD
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    6     1        YIELD                                                    1
    8     2        YIELD                                                    1
   10     3      > GENERATOR_RETURN                                         

End of function %00%7Bclosure%7D%2Fin%2FhskOD%3A3%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.36 ms | 1407 KiB | 15 Q