3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array_fill(0, 100, uniqid('', false)); $array2 = $array; $timer = microtime(true); for ($i = 0; $i < 10; $i++) { while (list($key, $value) = each($array)) { $array[$key] = 'value'; } } printf("While list each %.3f sec\n", microtime(true) - $timer); $timer = microtime(true); for ($i = 0; $i < 10; $i++) { foreach ($array2 as $key => &$value) { $value = 'value'; } } printf("Foreach %.3f sec\n", microtime(true) - $timer); var_dump(count($array), count($array2)); var_dump($array === $array2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 17
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
2 jumps found. (Code = 44) Position 1 = 54, Position 2 = 45
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
2 jumps found. (Code = 125) Position 1 = 46, Position 2 = 50
Branch analysis from position: 46
2 jumps found. (Code = 126) Position 1 = 47, Position 2 = 50
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
Branch analysis from position: 50
2 jumps found. (Code = 44) Position 1 = 54, Position 2 = 45
Branch analysis from position: 54
Branch analysis from position: 45
Branch analysis from position: 50
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 18
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 17
Branch analysis from position: 31
Branch analysis from position: 17
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 18
Branch analysis from position: 28
Branch analysis from position: 18
filename:       /in/Ohr76
function name:  (null)
number of ops:  73
compiled vars:  !0 = $array, !1 = $array2, !2 = $timer, !3 = $i, !4 = $key, !5 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'array_fill'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 100
          3        INIT_FCALL                                               'uniqid'
          4        SEND_VAL                                                 ''
          5        SEND_VAL                                                 <false>
          6        DO_ICALL                                         $6      
          7        SEND_VAR                                                 $6
          8        DO_ICALL                                         $7      
          9        ASSIGN                                                   !0, $7
    4    10        ASSIGN                                                   !1, !0
    5    11        INIT_FCALL                                               'microtime'
         12        SEND_VAL                                                 <true>
         13        DO_ICALL                                         $10     
         14        ASSIGN                                                   !2, $10
    6    15        ASSIGN                                                   !3, 0
         16      > JMP                                                      ->29
    7    17    > > JMP                                                      ->20
    8    18    >   ASSIGN_DIM                                               !0, !4
         19        OP_DATA                                                  'value'
    7    20    >   INIT_FCALL_BY_NAME                                       'each'
         21        SEND_VAR_EX                                              !0
         22        DO_FCALL                                      0  $14     
         23        FETCH_LIST_R                                     $15     $14, 0
         24        ASSIGN                                                   !4, $15
         25        FETCH_LIST_R                                     $17     $14, 1
         26        ASSIGN                                                   !5, $17
         27      > JMPNZ                                                    $14, ->18
    6    28    >   PRE_INC                                                  !3
         29    >   IS_SMALLER                                               !3, 10
         30      > JMPNZ                                                    ~20, ->17
   11    31    >   INIT_FCALL                                               'printf'
         32        SEND_VAL                                                 'While+list+each+%25.3f+sec%0A'
         33        INIT_FCALL                                               'microtime'
         34        SEND_VAL                                                 <true>
         35        DO_ICALL                                         $21     
         36        SUB                                              ~22     $21, !2
         37        SEND_VAL                                                 ~22
         38        DO_ICALL                                                 
   12    39        INIT_FCALL                                               'microtime'
         40        SEND_VAL                                                 <true>
         41        DO_ICALL                                         $24     
         42        ASSIGN                                                   !2, $24
   13    43        ASSIGN                                                   !3, 0
         44      > JMP                                                      ->52
   14    45    > > FE_RESET_RW                                      $27     !1, ->50
         46    > > FE_FETCH_RW                                      ~28     $27, !5, ->50
         47    >   ASSIGN                                                   !4, ~28
   15    48        ASSIGN                                                   !5, 'value'
   14    49      > JMP                                                      ->46
         50    >   FE_FREE                                                  $27
   13    51        PRE_INC                                                  !3
         52    >   IS_SMALLER                                               !3, 10
         53      > JMPNZ                                                    ~32, ->45
   18    54    >   INIT_FCALL                                               'printf'
         55        SEND_VAL                                                 'Foreach+%25.3f+sec%0A'
         56        INIT_FCALL                                               'microtime'
         57        SEND_VAL                                                 <true>
         58        DO_ICALL                                         $33     
         59        SUB                                              ~34     $33, !2
         60        SEND_VAL                                                 ~34
         61        DO_ICALL                                                 
   19    62        INIT_FCALL                                               'var_dump'
         63        COUNT                                            ~36     !0
         64        SEND_VAL                                                 ~36
         65        COUNT                                            ~37     !1
         66        SEND_VAL                                                 ~37
         67        DO_ICALL                                                 
   20    68        INIT_FCALL                                               'var_dump'
         69        IS_IDENTICAL                                     ~39     !0, !1
         70        SEND_VAL                                                 ~39
         71        DO_ICALL                                                 
         72      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.86 ms | 1013 KiB | 19 Q