3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generates() { $a = (yield 1); $b = (yield 2); assert($b != null); yield 1; } $g = generates(); foreach ($g as $val) { $g->send($val); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/tYN2p
function name:  (null)
number of ops:  11
compiled vars:  !0 = $g, !1 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'generates'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   14     3      > FE_RESET_R                                       $4      !0, ->9
          4    > > FE_FETCH_R                                               $4, !1, ->9
   15     5    >   INIT_METHOD_CALL                                         !0, 'send'
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0          
   14     8      > JMP                                                      ->4
          9    >   FE_FREE                                                  $4
   16    10      > RETURN                                                   1

Function generates:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/tYN2p
function name:  generates
number of ops:  13
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    5     1        YIELD                                            $2      1
          2        ASSIGN                                                   !0, $2
    6     3        YIELD                                            $4      2
          4        ASSIGN                                                   !1, $4
    8     5        ASSERT_CHECK                                             
          6        INIT_FCALL                                               'assert'
          7        IS_NOT_EQUAL                                     ~6      !1, null
          8        SEND_VAL                                                 ~6
          9        SEND_VAL                                                 'assert%28%24b+%21%3D+null%29'
         10        DO_ICALL                                                 
   10    11        YIELD                                                    1
   11    12      > GENERATOR_RETURN                                         

End of function generates

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
336.87 ms | 1399 KiB | 17 Q