3v4l.org

run code in 500+ PHP versions simultaneously
<?php $factory = static function (): Generator { foreach (['a', 'b', 'c', 'd', 'e'] as $item) { $result = (yield $item); echo " {$item} = {$result}".PHP_EOL; } }; $generator = $factory(); foreach ($generator as $item) { echo "value: {$item}".PHP_EOL; $generator->send($item.'+'); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 16
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 16
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/qUmrk
function name:  (null)
number of ops:  18
compiled vars:  !0 = $factory, !1 = $generator, !2 = $item
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_LAMBDA_FUNCTION                              ~3      [0]
          1        ASSIGN                                                       !0, ~3
   11     2        INIT_DYNAMIC_CALL                                            !0
          3        DO_FCALL                                          0  $5      
          4        ASSIGN                                                       !1, $5
   13     5      > FE_RESET_R                                           $7      !1, ->16
          6    > > FE_FETCH_R                                                   $7, !2, ->16
   14     7    >   NOP                                                          
          8        FAST_CONCAT                                          ~8      'value%3A+', !2
          9        CONCAT                                               ~9      ~8, '%0A'
         10        ECHO                                                         ~9
   16    11        INIT_METHOD_CALL                                             !1, 'send'
         12        CONCAT                                               ~10     !2, '%2B'
         13        SEND_VAL_EX                                                  ~10
         14        DO_FCALL                                          0          
   13    15      > JMP                                                          ->6
         16    >   FE_FREE                                                      $7
   17    17      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 12
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 12
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 12
filename:       /in/qUmrk
function name:  {closure:/in/qUmrk:3}
number of ops:  14
compiled vars:  !0 = $item, !1 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                             
    4     1      > FE_RESET_R                                           $2      <array>, ->12
          2    > > FE_FETCH_R                                                   $2, !0, ->12
    5     3    >   YIELD                                                $3      !0
          4        ASSIGN                                                       !1, $3
    7     5        ROPE_INIT                                         4  ~6      '++'
          6        ROPE_ADD                                          1  ~6      ~6, !0
          7        ROPE_ADD                                          2  ~6      ~6, '+%3D+'
          8        ROPE_END                                          3  ~5      ~6, !1
          9        CONCAT                                               ~8      ~5, '%0A'
         10        ECHO                                                         ~8
    4    11      > JMP                                                          ->2
         12    >   FE_FREE                                                      $2
    9    13      > GENERATOR_RETURN                                             

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
125.2 ms | 480 KiB | 7 Q