3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('KEYS', 1000); $a = array(); function fill(&$arr) { for ($i = 1; $i <= 10; $i++) { $arr['key-' . $i] = $i; } } function read_key(&$arr) { for ($i = 1; $i <= KEYS; $i++) { for ($j = 1; $j <= 10; $i++) { //$v = $arr['key-' . $i]; } } } function for_each(&$arr) { for ($i = 1; $i <= 1000; $i++) { foreach ($arr as $key => $value) { //$v = $value; } } } fill($a); //read_key($a); for_each($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RZZfL
function name:  (null)
number of ops:  12
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'define'
          1        SEND_VAL                                                 'KEYS'
          2        SEND_VAL                                                 1000
          3        DO_ICALL                                                 
    5     4        ASSIGN                                                   !0, <array>
   30     5        INIT_FCALL                                               'fill'
          6        SEND_REF                                                 !0
          7        DO_FCALL                                      0          
   32     8        INIT_FCALL                                               'for_each'
          9        SEND_REF                                                 !0
         10        DO_FCALL                                      0          
         11      > RETURN                                                   1

Function fill:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 3
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 3
Branch analysis from position: 9
Branch analysis from position: 3
filename:       /in/RZZfL
function name:  fill
number of ops:  10
compiled vars:  !0 = $arr, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ASSIGN                                                   !1, 1
          2      > JMP                                                      ->7
    9     3    >   CONCAT                                           ~3      'key-', !1
          4        ASSIGN_DIM                                               !0, ~3
          5        OP_DATA                                                  !1
    8     6        PRE_INC                                                  !1
          7    >   IS_SMALLER_OR_EQUAL                                      !1, 10
          8      > JMPNZ                                                    ~6, ->3
   11     9    > > RETURN                                                   null

End of function fill

Function read_key:
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 = 12, Position 2 = 3
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 5
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 3
Branch analysis from position: 12
Branch analysis from position: 3
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 5
Branch analysis from position: 8
Branch analysis from position: 5
filename:       /in/RZZfL
function name:  read_key
number of ops:  13
compiled vars:  !0 = $arr, !1 = $i, !2 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        ASSIGN                                                   !1, 1
          2      > JMP                                                      ->9
   15     3    >   ASSIGN                                                   !2, 1
          4      > JMP                                                      ->6
          5    >   PRE_INC                                                  !1
          6    >   IS_SMALLER_OR_EQUAL                                      !2, 10
          7      > JMPNZ                                                    ~6, ->5
   14     8    >   PRE_INC                                                  !1
          9    >   FETCH_CONSTANT                                   ~8      'KEYS'
         10        IS_SMALLER_OR_EQUAL                                      !1, ~8
         11      > JMPNZ                                                    ~9, ->3
   19    12    > > RETURN                                                   null

End of function read_key

Function for_each:
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 = 3
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 3
Branch analysis from position: 11
Branch analysis from position: 3
Branch analysis from position: 7
filename:       /in/RZZfL
function name:  for_each
number of ops:  12
compiled vars:  !0 = $arr, !1 = $i, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1        ASSIGN                                                   !1, 1
          2      > JMP                                                      ->9
   23     3    > > FE_RESET_R                                       $5      !0, ->7
          4    > > FE_FETCH_R                                       ~6      $5, !2, ->7
          5    >   ASSIGN                                                   !3, ~6
          6      > JMP                                                      ->4
          7    >   FE_FREE                                                  $5
   22     8        PRE_INC                                                  !1
          9    >   IS_SMALLER_OR_EQUAL                                      !1, 1000
         10      > JMPNZ                                                    ~9, ->3
   27    11    > > RETURN                                                   null

End of function for_each

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.42 ms | 1394 KiB | 17 Q