3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classmap1 = array(); for ($i=1; $i<=10000; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=10000; $i++) { $classmap2['b'.$i] = $i+1; } $startTimeMerge = microtime(true); $map = array_merge($classmap1, $classmap2); $endTimeMerge = microtime(true); $startTimeReplace = microtime(true); $map = array_replace($classmap1, $classmap2); $endTimeReplace = microtime(true); $startTimeForeach = microtime(true); foreach ($classmap2 as $k => $v) { $classmap1[$k] = $v; } $endTimeForeach = microtime(true); echo "array_merge - " . (($endTimeMerge - $startTimeMerge)*1000) ." microseconds<br />\n"; echo "array_replace - " . (($endTimeReplace - $startTimeReplace)*1000) ." microseconds<br />\n"; echo "foreach - " . (($endTimeForeach - $startTimeForeach)*1000) ." microseconds<br />\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 13
Branch analysis from position: 20
2 jumps found. (Code = 77) Position 1 = 51, Position 2 = 56
Branch analysis from position: 51
2 jumps found. (Code = 78) Position 1 = 52, Position 2 = 56
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 56
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 13
Branch analysis from position: 20
Branch analysis from position: 13
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
Branch analysis from position: 3
filename:       /in/ffRXp
function name:  (null)
number of ops:  77
compiled vars:  !0 = $classmap1, !1 = $i, !2 = $classmap2, !3 = $startTimeMerge, !4 = $map, !5 = $endTimeMerge, !6 = $startTimeReplace, !7 = $endTimeReplace, !8 = $startTimeForeach, !9 = $v, !10 = $k, !11 = $endTimeForeach
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 1
          2      > JMP                                                      ->8
    5     3    >   CONCAT                                           ~14     'a', !1
          4        ADD                                              ~16     !1, 1
          5        ASSIGN_DIM                                               !0, ~14
          6        OP_DATA                                                  ~16
    4     7        PRE_INC                                                  !1
          8    >   IS_SMALLER_OR_EQUAL                                      !1, 10000
          9      > JMPNZ                                                    ~18, ->3
    7    10    >   ASSIGN                                                   !2, <array>
    9    11        ASSIGN                                                   !1, 1
         12      > JMP                                                      ->18
   10    13    >   CONCAT                                           ~21     'b', !1
         14        ADD                                              ~23     !1, 1
         15        ASSIGN_DIM                                               !2, ~21
         16        OP_DATA                                                  ~23
    9    17        PRE_INC                                                  !1
         18    >   IS_SMALLER_OR_EQUAL                                      !1, 10000
         19      > JMPNZ                                                    ~25, ->13
   14    20    >   INIT_FCALL                                               'microtime'
         21        SEND_VAL                                                 <true>
         22        DO_ICALL                                         $26     
         23        ASSIGN                                                   !3, $26
   15    24        INIT_FCALL                                               'array_merge'
         25        SEND_VAR                                                 !0
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                         $28     
         28        ASSIGN                                                   !4, $28
   16    29        INIT_FCALL                                               'microtime'
         30        SEND_VAL                                                 <true>
         31        DO_ICALL                                         $30     
         32        ASSIGN                                                   !5, $30
   19    33        INIT_FCALL                                               'microtime'
         34        SEND_VAL                                                 <true>
         35        DO_ICALL                                         $32     
         36        ASSIGN                                                   !6, $32
   20    37        INIT_FCALL                                               'array_replace'
         38        SEND_VAR                                                 !0
         39        SEND_VAR                                                 !2
         40        DO_ICALL                                         $34     
         41        ASSIGN                                                   !4, $34
   21    42        INIT_FCALL                                               'microtime'
         43        SEND_VAL                                                 <true>
         44        DO_ICALL                                         $36     
         45        ASSIGN                                                   !7, $36
   23    46        INIT_FCALL                                               'microtime'
         47        SEND_VAL                                                 <true>
         48        DO_ICALL                                         $38     
         49        ASSIGN                                                   !8, $38
   24    50      > FE_RESET_R                                       $40     !2, ->56
         51    > > FE_FETCH_R                                       ~41     $40, !9, ->56
         52    >   ASSIGN                                                   !10, ~41
   25    53        ASSIGN_DIM                                               !0, !10
         54        OP_DATA                                                  !9
   24    55      > JMP                                                      ->51
         56    >   FE_FREE                                                  $40
   27    57        INIT_FCALL                                               'microtime'
         58        SEND_VAL                                                 <true>
         59        DO_ICALL                                         $44     
         60        ASSIGN                                                   !11, $44
   29    61        SUB                                              ~46     !5, !3
         62        MUL                                              ~47     ~46, 1000
         63        CONCAT                                           ~48     'array_merge+++-+', ~47
         64        CONCAT                                           ~49     ~48, '+microseconds%3Cbr+%2F%3E%0A'
         65        ECHO                                                     ~49
   30    66        SUB                                              ~50     !7, !6
         67        MUL                                              ~51     ~50, 1000
         68        CONCAT                                           ~52     'array_replace+-+', ~51
         69        CONCAT                                           ~53     ~52, '+microseconds%3Cbr+%2F%3E%0A'
         70        ECHO                                                     ~53
   31    71        SUB                                              ~54     !11, !8
         72        MUL                                              ~55     ~54, 1000
         73        CONCAT                                           ~56     'foreach+++++++-+', ~55
         74        CONCAT                                           ~57     ~56, '+microseconds%3Cbr+%2F%3E%0A'
         75        ECHO                                                     ~57
         76      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.01 ms | 1400 KiB | 19 Q