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); $startTimePlus = microtime(true); $map = $classmap1 + $classmap2; $endTimePlus = 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 "array + array - " . (($endTimePlus - $startTimePlus)*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 = 61, Position 2 = 66
Branch analysis from position: 61
2 jumps found. (Code = 78) Position 1 = 62, Position 2 = 66
Branch analysis from position: 62
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
Branch analysis from position: 66
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 66
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/BANT2
function name:  (null)
number of ops:  92
compiled vars:  !0 = $classmap1, !1 = $i, !2 = $classmap2, !3 = $startTimeMerge, !4 = $map, !5 = $endTimeMerge, !6 = $startTimeReplace, !7 = $endTimeReplace, !8 = $startTimePlus, !9 = $endTimePlus, !10 = $startTimeForeach, !11 = $v, !12 = $k, !13 = $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                                           ~16     'a', !1
          4        ADD                                              ~18     !1, 1
          5        ASSIGN_DIM                                               !0, ~16
          6        OP_DATA                                                  ~18
    4     7        PRE_INC                                                  !1
          8    >   IS_SMALLER_OR_EQUAL                                      !1, 10000
          9      > JMPNZ                                                    ~20, ->3
    7    10    >   ASSIGN                                                   !2, <array>
    9    11        ASSIGN                                                   !1, 1
         12      > JMP                                                      ->18
   10    13    >   CONCAT                                           ~23     'b', !1
         14        ADD                                              ~25     !1, 1
         15        ASSIGN_DIM                                               !2, ~23
         16        OP_DATA                                                  ~25
    9    17        PRE_INC                                                  !1
         18    >   IS_SMALLER_OR_EQUAL                                      !1, 10000
         19      > JMPNZ                                                    ~27, ->13
   14    20    >   INIT_FCALL                                               'microtime'
         21        SEND_VAL                                                 <true>
         22        DO_ICALL                                         $28     
         23        ASSIGN                                                   !3, $28
   15    24        INIT_FCALL                                               'array_merge'
         25        SEND_VAR                                                 !0
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                         $30     
         28        ASSIGN                                                   !4, $30
   16    29        INIT_FCALL                                               'microtime'
         30        SEND_VAL                                                 <true>
         31        DO_ICALL                                         $32     
         32        ASSIGN                                                   !5, $32
   18    33        INIT_FCALL                                               'microtime'
         34        SEND_VAL                                                 <true>
         35        DO_ICALL                                         $34     
         36        ASSIGN                                                   !6, $34
   19    37        INIT_FCALL                                               'array_replace'
         38        SEND_VAR                                                 !0
         39        SEND_VAR                                                 !2
         40        DO_ICALL                                         $36     
         41        ASSIGN                                                   !4, $36
   20    42        INIT_FCALL                                               'microtime'
         43        SEND_VAL                                                 <true>
         44        DO_ICALL                                         $38     
         45        ASSIGN                                                   !7, $38
   22    46        INIT_FCALL                                               'microtime'
         47        SEND_VAL                                                 <true>
         48        DO_ICALL                                         $40     
         49        ASSIGN                                                   !8, $40
   23    50        ADD                                              ~42     !0, !2
         51        ASSIGN                                                   !4, ~42
   24    52        INIT_FCALL                                               'microtime'
         53        SEND_VAL                                                 <true>
         54        DO_ICALL                                         $44     
         55        ASSIGN                                                   !9, $44
   26    56        INIT_FCALL                                               'microtime'
         57        SEND_VAL                                                 <true>
         58        DO_ICALL                                         $46     
         59        ASSIGN                                                   !10, $46
   27    60      > FE_RESET_R                                       $48     !2, ->66
         61    > > FE_FETCH_R                                       ~49     $48, !11, ->66
         62    >   ASSIGN                                                   !12, ~49
   28    63        ASSIGN_DIM                                               !0, !12
         64        OP_DATA                                                  !11
   27    65      > JMP                                                      ->61
         66    >   FE_FREE                                                  $48
   30    67        INIT_FCALL                                               'microtime'
         68        SEND_VAL                                                 <true>
         69        DO_ICALL                                         $52     
         70        ASSIGN                                                   !13, $52
   32    71        SUB                                              ~54     !5, !3
         72        MUL                                              ~55     ~54, 1000
         73        CONCAT                                           ~56     'array_merge+++-+', ~55
         74        CONCAT                                           ~57     ~56, '+microseconds%3Cbr+%2F%3E%0A'
         75        ECHO                                                     ~57
   33    76        SUB                                              ~58     !7, !6
         77        MUL                                              ~59     ~58, 1000
         78        CONCAT                                           ~60     'array_replace+-+', ~59
         79        CONCAT                                           ~61     ~60, '+microseconds%3Cbr+%2F%3E%0A'
         80        ECHO                                                     ~61
   34    81        SUB                                              ~62     !9, !8
         82        MUL                                              ~63     ~62, 1000
         83        CONCAT                                           ~64     'array+%2B+array+-+', ~63
         84        CONCAT                                           ~65     ~64, '+microseconds%3Cbr+%2F%3E%0A'
         85        ECHO                                                     ~65
   35    86        SUB                                              ~66     !13, !10
         87        MUL                                              ~67     ~66, 1000
         88        CONCAT                                           ~68     'foreach+++++++-+', ~67
         89        CONCAT                                           ~69     ~68, '+microseconds%3Cbr+%2F%3E%0A'
         90        ECHO                                                     ~69
         91      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.95 ms | 1404 KiB | 19 Q