3v4l.org

run code in 300+ PHP versions simultaneously
<?php function lazyCall(callable $c) { $args = func_get_args(); yield $c(...$args); } function returnSome() { echo "Some", "\n"; yield "some"; } $g = lazyCall("returnSome"); echo "Foo"; $g->next(); echo "Bar"; $g->current()->next();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/REOmR
function name:  (null)
number of ops:  13
compiled vars:  !0 = $g
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'lazycall'
          1        SEND_VAL                                                 'returnSome'
          2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
   14     4        ECHO                                                     'Foo'
   15     5        INIT_METHOD_CALL                                         !0, 'next'
          6        DO_FCALL                                      0          
   16     7        ECHO                                                     'Bar'
   17     8        INIT_METHOD_CALL                                         !0, 'current'
          9        DO_FCALL                                      0  $4      
         10        INIT_METHOD_CALL                                         $4, 'next'
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

Function lazycall:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/REOmR
function name:  lazyCall
number of ops:  10
compiled vars:  !0 = $c, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    4     2        FUNC_GET_ARGS                                    ~2      
          3        ASSIGN                                                   !1, ~2
    5     4        INIT_DYNAMIC_CALL                                        !0
          5        SEND_UNPACK                                              !1
          6        CHECK_UNDEF_ARGS                                         
          7        DO_FCALL                                      1  $4      
          8        YIELD                                                    $4
    6     9      > GENERATOR_RETURN                                         

End of function lazycall

Function returnsome:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/REOmR
function name:  returnSome
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   GENERATOR_CREATE                                         
    9     1        ECHO                                                     'Some'
          2        ECHO                                                     '%0A'
   10     3        YIELD                                                    'some'
   11     4      > GENERATOR_RETURN                                         

End of function returnsome

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.91 ms | 1399 KiB | 14 Q