3v4l.org

run code in 300+ PHP versions simultaneously
<?php $gen = function ($client, $stream) { while ($record = yield) { yield [ 'StreamName' => $stream, 'PartitionKey' => 'group' . rand(1, 5), 'Data' => $record, ]; } }; $records = $gen('things'); while ($records->valid()) { var_dump($records->current()); $records->next(); } $records->send('<Record Data>'); $records->send('<Record Data>'); while ($records->valid()) { var_dump($records->current()); $records->next(); } $records->send('<Record Data>'); $records->send('<Record Data>'); while ($records->valid()) { var_dump($records->current()); $records->next(); } $records->send('<Record Data>'); $records->send('<Record Data>'); $records->send('<Record Data>'); $records->send('<Record Data>'); $records->send('<Record Data>'); $records->send('<Record Data>'); while ($records->valid()) { var_dump($records->current()); $records->next(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 7
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 24
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 41
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 77
Branch analysis from position: 77
2 jumps found. (Code = 44) Position 1 = 80, Position 2 = 70
Branch analysis from position: 80
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 70
2 jumps found. (Code = 44) Position 1 = 80, Position 2 = 70
Branch analysis from position: 80
Branch analysis from position: 70
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 41
Branch analysis from position: 51
Branch analysis from position: 41
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 24
Branch analysis from position: 34
Branch analysis from position: 24
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 7
Branch analysis from position: 17
Branch analysis from position: 7
filename:       /in/Oq2st
function name:  (null)
number of ops:  81
compiled vars:  !0 = $gen, !1 = $records
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FOq2st%3A3%240'
          1        ASSIGN                                                   !0, ~2
   13     2        INIT_DYNAMIC_CALL                                        !0
          3        SEND_VAL_EX                                              'things'
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !1, $4
   15     6      > JMP                                                      ->14
   16     7    >   INIT_FCALL                                               'var_dump'
          8        INIT_METHOD_CALL                                         !1, 'current'
          9        DO_FCALL                                      0  $6      
         10        SEND_VAR                                                 $6
         11        DO_ICALL                                                 
   17    12        INIT_METHOD_CALL                                         !1, 'next'
         13        DO_FCALL                                      0          
   15    14    >   INIT_METHOD_CALL                                         !1, 'valid'
         15        DO_FCALL                                      0  $9      
         16      > JMPNZ                                                    $9, ->7
   20    17    >   INIT_METHOD_CALL                                         !1, 'send'
         18        SEND_VAL_EX                                              '%3CRecord+Data%3E'
         19        DO_FCALL                                      0          
   21    20        INIT_METHOD_CALL                                         !1, 'send'
         21        SEND_VAL_EX                                              '%3CRecord+Data%3E'
         22        DO_FCALL                                      0          
   23    23      > JMP                                                      ->31
   24    24    >   INIT_FCALL                                               'var_dump'
         25        INIT_METHOD_CALL                                         !1, 'current'
         26        DO_FCALL                                      0  $12     
         27        SEND_VAR                                                 $12
         28        DO_ICALL                                                 
   25    29        INIT_METHOD_CALL                                         !1, 'next'
         30        DO_FCALL                                      0          
   23    31    >   INIT_METHOD_CALL                                         !1, 'valid'
         32        DO_FCALL                                      0  $15     
         33      > JMPNZ                                                    $15, ->24
   28    34    >   INIT_METHOD_CALL                                         !1, 'send'
         35        SEND_VAL_EX                                              '%3CRecord+Data%3E'
         36        DO_FCALL                                      0          
   29    37        INIT_METHOD_CALL                                         !1, 'send'
         38        SEND_VAL_EX                                              '%3CRecord+Data%3E'
         39        DO_FCALL                                      0          
   31    40      > JMP                                                      ->48
   32    41    >   INIT_FCALL                                               'var_dump'
         42        INIT_METHOD_CALL                                         !1, 'current'
         43        DO_FCALL                                      0  $18     
         44        SEND_VAR                                                 $18
         45        DO_ICALL                                                 
   33    46        INIT_METHOD_CALL                                         !1, 'next'
         47        DO_FCALL                                      0          
   31    48    >   INIT_METHOD_CALL                                         !1, 'valid'
         49        DO_FCALL                                      0  $21     
         50      > JMPNZ                                                    $21, ->41
   35    51    >   INIT_METHOD_CALL                                         !1, 'send'
         52        SEND_VAL_EX                                              '%3CRecord+Data%3E'
         53        DO_FCALL                                      0          
   36    54        INIT_METHOD_CALL                                         !1, 'send'
         55        SEND_VAL_EX                                              '%3CRecord+Data%3E'
         56        DO_FCALL                                      0          
   37    57        INIT_METHOD_CALL                                         !1, 'send'
         58        SEND_VAL_EX                                              '%3CRecord+Data%3E'
         59        DO_FCALL                                      0          
   38    60        INIT_METHOD_CALL                                         !1, 'send'
         61        SEND_VAL_EX                                              '%3CRecord+Data%3E'
         62        DO_FCALL                                      0          
   39    63        INIT_METHOD_CALL                                         !1, 'send'
         64        SEND_VAL_EX                                              '%3CRecord+Data%3E'
         65        DO_FCALL                                      0          
   40    66        INIT_METHOD_CALL                                         !1, 'send'
         67        SEND_VAL_EX                                              '%3CRecord+Data%3E'
         68        DO_FCALL                                      0          
   42    69      > JMP                                                      ->77
   43    70    >   INIT_FCALL                                               'var_dump'
         71        INIT_METHOD_CALL                                         !1, 'current'
         72        DO_FCALL                                      0  $28     
         73        SEND_VAR                                                 $28
         74        DO_ICALL                                                 
   44    75        INIT_METHOD_CALL                                         !1, 'next'
         76        DO_FCALL                                      0          
   42    77    >   INIT_METHOD_CALL                                         !1, 'valid'
         78        DO_FCALL                                      0  $31     
         79      > JMPNZ                                                    $31, ->70
   45    80    > > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FOq2st%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 4
Branch analysis from position: 16
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 4
Branch analysis from position: 16
Branch analysis from position: 4
filename:       /in/Oq2st
function name:  {closure}
number of ops:  17
compiled vars:  !0 = $client, !1 = $stream, !2 = $record
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        GENERATOR_CREATE                                         
    4     3      > JMP                                                      ->13
    6     4    >   INIT_ARRAY                                       ~3      !1, 'StreamName'
    7     5        INIT_FCALL                                               'rand'
          6        SEND_VAL                                                 1
          7        SEND_VAL                                                 5
          8        DO_ICALL                                         $4      
          9        CONCAT                                           ~5      'group', $4
         10        ADD_ARRAY_ELEMENT                                ~3      ~5, 'PartitionKey'
    8    11        ADD_ARRAY_ELEMENT                                ~3      !2, 'Data'
         12        YIELD                                                    ~3
    4    13    >   YIELD                                            $7      
         14        ASSIGN                                           ~8      !2, $7
         15      > JMPNZ                                                    ~8, ->4
   11    16    > > GENERATOR_RETURN                                         

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.85 ms | 1404 KiB | 17 Q