3v4l.org

run code in 500+ PHP versions simultaneously
<?php $ages = [18,25,36,20,23,21,31]; $groups = array_count_values(array_map(function ($v) { return (int)($v / 10); }, $ages)); for ($i = 0; $i <= max(array_keys($groups)); $i++) { echo $i*10 . " to " . ($i*10+9) . " years: " . (isset($groups[$i]) ? $groups[$i]: 0) . "\n"; } for ($i = 0; $i <= max(array_keys($groups)); $i++) { if (isset($groups[$i])) echo $i*10 . " to " . ($i*10+9) . " years: " . $groups[$i] . "\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 12
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 38
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 50
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 38
Branch analysis from position: 59
Branch analysis from position: 38
Branch analysis from position: 50
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 12
Branch analysis from position: 36
Branch analysis from position: 12
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 12
Branch analysis from position: 36
Branch analysis from position: 12
filename:       /in/fTheO
function name:  (null)
number of ops:  60
compiled vars:  !0 = $ages, !1 = $groups, !2 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, <array>
    3     1        INIT_FCALL                                                   'array_count_values'
          2        INIT_FCALL                                                   'array_map'
          3        DECLARE_LAMBDA_FUNCTION                              ~4      [0]
          4        SEND_VAL                                                     ~4
          5        SEND_VAR                                                     !0
          6        DO_ICALL                                             $5      
          7        SEND_VAR                                                     $5
          8        DO_ICALL                                             $6      
          9        ASSIGN                                                       !1, $6
    4    10        ASSIGN                                                       !2, 0
         11      > JMP                                                          ->28
    5    12    >   MUL                                                  ~9      !2, 10
         13        CONCAT                                               ~10     ~9, '+to+'
         14        MUL                                                  ~11     !2, 10
         15        ADD                                                  ~12     ~11, 9
         16        CONCAT                                               ~13     ~10, ~12
         17        CONCAT                                               ~14     ~13, '+years%3A+'
         18        ISSET_ISEMPTY_DIM_OBJ                             0          !1, !2
         19      > JMPZ                                                         ~15, ->23
         20    >   FETCH_DIM_R                                          ~16     !1, !2
         21        QM_ASSIGN                                            ~17     ~16
         22      > JMP                                                          ->24
         23    >   QM_ASSIGN                                            ~17     0
         24    >   CONCAT                                               ~18     ~14, ~17
         25        CONCAT                                               ~19     ~18, '%0A'
         26        ECHO                                                         ~19
    4    27        PRE_INC                                                      !2
         28    >   INIT_FCALL                                                   'max'
         29        INIT_FCALL                                                   'array_keys'
         30        SEND_VAR                                                     !1
         31        DO_ICALL                                             $21     
         32        SEND_VAR                                                     $21
         33        DO_ICALL                                             $22     
         34        IS_SMALLER_OR_EQUAL                                          !2, $22
         35      > JMPNZ                                                        ~23, ->12
    7    36    >   ASSIGN                                                       !2, 0
         37      > JMP                                                          ->51
    8    38    >   ISSET_ISEMPTY_DIM_OBJ                             0          !1, !2
         39      > JMPZ                                                         ~25, ->50
         40    >   MUL                                                  ~26     !2, 10
         41        CONCAT                                               ~27     ~26, '+to+'
         42        MUL                                                  ~28     !2, 10
         43        ADD                                                  ~29     ~28, 9
         44        CONCAT                                               ~30     ~27, ~29
         45        CONCAT                                               ~31     ~30, '+years%3A+'
         46        FETCH_DIM_R                                          ~32     !1, !2
         47        CONCAT                                               ~33     ~31, ~32
         48        CONCAT                                               ~34     ~33, '%0A'
         49        ECHO                                                         ~34
    7    50    >   PRE_INC                                                      !2
         51    >   INIT_FCALL                                                   'max'
         52        INIT_FCALL                                                   'array_keys'
         53        SEND_VAR                                                     !1
         54        DO_ICALL                                             $36     
         55        SEND_VAR                                                     $36
         56        DO_ICALL                                             $37     
         57        IS_SMALLER_OR_EQUAL                                          !2, $37
         58      > JMPNZ                                                        ~38, ->38
    9    59    > > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fTheO
function name:  {closure:/in/fTheO:3}
number of ops:  5
compiled vars:  !0 = $v
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        DIV                                                  ~1      !0, 10
          2        CAST                                              4  ~2      ~1
          3      > RETURN                                                       ~2
          4*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.89 ms | 2159 KiB | 17 Q