3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Everything you enter here will be executed by our servers. Try it! $foo = function () { $bar = (yield "foo"); var_dump($bar); }; $c = $foo(); var_dump($c->current()); $c->next(); $c->send("bar");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AHMqG
function name:  (null)
number of ops:  16
compiled vars:  !0 = $foo, !1 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FAHMqG%3A4%240'
          1        ASSIGN                                                   !0, ~2
    9     2        INIT_DYNAMIC_CALL                                        !0
          3        DO_FCALL                                      0  $4      
          4        ASSIGN                                                   !1, $4
   11     5        INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !1, 'current'
          7        DO_FCALL                                      0  $6      
          8        SEND_VAR                                                 $6
          9        DO_ICALL                                                 
   12    10        INIT_METHOD_CALL                                         !1, 'next'
         11        DO_FCALL                                      0          
   13    12        INIT_METHOD_CALL                                         !1, 'send'
         13        SEND_VAL_EX                                              'bar'
         14        DO_FCALL                                      0          
         15      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FAHMqG%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/AHMqG
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   GENERATOR_CREATE                                         
    5     1        YIELD                                            $1      'foo'
          2        ASSIGN                                                   !0, $1
    6     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
    7     6      > GENERATOR_RETURN                                         

End of function %00%7Bclosure%7D%2Fin%2FAHMqG%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.83 ms | 1395 KiB | 15 Q