3v4l.org

run code in 300+ PHP versions simultaneously
<?php function hash2($n) { for ($i = 0; $i < $n; $i++) { $hash1["foo_$i"] = $i; $hash2["foo_$i"] = 0; } for ($i = $n; $i > 0; $i--) { foreach($hash1 as $key => $value) { $hash2[$key] += $value; } } $first = "foo_0"; $last = "foo_".($n-1); print "{$hash1[$first]} {$hash1[$last]} {$hash2[$first]} {$hash2[$last]}\n"; } hash2(1000);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4MjsE
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'hash2'
          1        SEND_VAL                                                 1000
          2        DO_FCALL                                      0          
          3      > RETURN                                                   1

Function hash2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 3
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 16
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 77) Position 1 = 17, Position 2 = 22
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 16
Branch analysis from position: 26
Branch analysis from position: 16
Branch analysis from position: 22
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 3
Branch analysis from position: 14
Branch analysis from position: 3
filename:       /in/4MjsE
function name:  hash2
number of ops:  44
compiled vars:  !0 = $n, !1 = $i, !2 = $hash1, !3 = $hash2, !4 = $value, !5 = $key, !6 = $first, !7 = $last
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->12
    4     3    >   NOP                                                      
          4        FAST_CONCAT                                      ~9      'foo_', !1
          5        ASSIGN_DIM                                               !2, ~9
          6        OP_DATA                                                  !1
    5     7        NOP                                                      
          8        FAST_CONCAT                                      ~11     'foo_', !1
          9        ASSIGN_DIM                                               !3, ~11
         10        OP_DATA                                                  0
    3    11        PRE_INC                                                  !1
         12    >   IS_SMALLER                                               !1, !0
         13      > JMPNZ                                                    ~14, ->3
    7    14    >   ASSIGN                                                   !1, !0
         15      > JMP                                                      ->24
    8    16    > > FE_RESET_R                                       $16     !2, ->22
         17    > > FE_FETCH_R                                       ~17     $16, !4, ->22
         18    >   ASSIGN                                                   !5, ~17
    9    19        ASSIGN_DIM_OP                +=               1          !3, !5
         20        OP_DATA                                                  !4
    8    21      > JMP                                                      ->17
         22    >   FE_FREE                                                  $16
    7    23        PRE_DEC                                                  !1
         24    >   IS_SMALLER                                               0, !1
         25      > JMPNZ                                                    ~21, ->16
   12    26    >   ASSIGN                                                   !6, 'foo_0'
   13    27        SUB                                              ~23     !0, 1
         28        CONCAT                                           ~24     'foo_', ~23
         29        ASSIGN                                                   !7, ~24
   14    30        FETCH_DIM_R                                      ~26     !2, !6
         31        ROPE_INIT                                     8  ~31     ~26
         32        ROPE_ADD                                      1  ~31     ~31, '+'
         33        FETCH_DIM_R                                      ~27     !2, !7
         34        ROPE_ADD                                      2  ~31     ~31, ~27
         35        ROPE_ADD                                      3  ~31     ~31, '+'
         36        FETCH_DIM_R                                      ~28     !3, !6
         37        ROPE_ADD                                      4  ~31     ~31, ~28
         38        ROPE_ADD                                      5  ~31     ~31, '+'
         39        FETCH_DIM_R                                      ~29     !3, !7
         40        ROPE_ADD                                      6  ~31     ~31, ~29
         41        ROPE_END                                      7  ~30     ~31, '%0A'
         42        ECHO                                                     ~30
   15    43      > RETURN                                                   null

End of function hash2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.45 ms | 1403 KiB | 14 Q