3v4l.org

run code in 500+ PHP versions simultaneously
<?php function generate_nums(int $count) { $n = $count; while ($n--) { yield random_int(1, 100); } } function generate_ten_nums() { yield from generate_nums(5); yield from generate_nums(5); } print_r(iterator_to_array(generate_ten_nums()));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HSCmf
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                                   'print_r'
          1        INIT_FCALL                                                   'iterator_to_array'
          2        INIT_FCALL                                                   'generate_ten_nums'
          3        DO_FCALL                                          0  $0      
          4        SEND_VAR                                                     $0
          5        DO_ICALL                                             $1      
          6        SEND_VAR                                                     $1
          7        DO_ICALL                                                     
          8      > RETURN                                                       1

Function generate_nums:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 4
Branch analysis from position: 11
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 4
Branch analysis from position: 11
Branch analysis from position: 4
filename:       /in/HSCmf
function name:  generate_nums
number of ops:  12
compiled vars:  !0 = $count, !1 = $n
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
          1        GENERATOR_CREATE                                             
    5     2        ASSIGN                                                       !1, !0
    6     3      > JMP                                                          ->9
    7     4    >   INIT_FCALL                                                   'random_int'
          5        SEND_VAL                                                     1
          6        SEND_VAL                                                     100
          7        DO_ICALL                                             $3      
          8        YIELD                                                        $3
    6     9    >   POST_DEC                                             ~5      !1
         10      > JMPNZ                                                        ~5, ->4
    9    11    > > GENERATOR_RETURN                                             

End of function generate_nums

Function generate_ten_nums:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/HSCmf
function name:  generate_ten_nums
number of ops:  12
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   GENERATOR_CREATE                                             
   12     1        INIT_FCALL                                                   'generate_nums'
          2        SEND_VAL                                                     5
          3        DO_FCALL                                          0  $0      
          4        YIELD_FROM                                           ~1      $0
          5        FREE                                                         ~1
   13     6        INIT_FCALL                                                   'generate_nums'
          7        SEND_VAL                                                     5
          8        DO_FCALL                                          0  $2      
          9        YIELD_FROM                                           ~3      $2
         10        FREE                                                         ~3
   14    11      > GENERATOR_RETURN                                             

End of function generate_ten_nums

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.84 ms | 1366 KiB | 18 Q