3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('KEYS', 100); $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 <= KEYS; $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/tEv0M
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                                                 100
          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/tEv0M
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 for_each:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 3
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 3
Branch analysis from position: 13
Branch analysis from position: 3
Branch analysis from position: 8
filename:       /in/tEv0M
function name:  for_each
number of ops:  14
compiled vars:  !0 = $arr, !1 = $i, !2 = $value, !3 = $key, !4 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1        ASSIGN                                                   !1, 1
          2      > JMP                                                      ->10
   23     3    > > FE_RESET_R                                       $6      !0, ->8
          4    > > FE_FETCH_R                                       ~7      $6, !2, ->8
          5    >   ASSIGN                                                   !3, ~7
   24     6        ASSIGN                                                   !4, !2
   23     7      > JMP                                                      ->4
          8    >   FE_FREE                                                  $6
   22     9        PRE_INC                                                  !1
         10    >   FETCH_CONSTANT                                   ~11     'KEYS'
         11        IS_SMALLER_OR_EQUAL                                      !1, ~11
         12      > JMPNZ                                                    ~12, ->3
   27    13    > > RETURN                                                   null

End of function for_each

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.46 ms | 1394 KiB | 17 Q