3v4l.org

run code in 300+ PHP versions simultaneously
<?php $startTime = microtime(true); for($i=0; $i<100000; $i++) { $foo = "foo"; $bar = "bar"; $baz = "baz"; $array = compact('foo','bar','baz'); } $endTime = microtime(true); $elapsed = $endTime - $startTime; echo "With compact : $elapsed seconds\n"; $startTime = microtime(true); for($i=0; $i<100000; $i++) { $array = [ 'foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz' ]; } $endTime = microtime(true); $elapsed = $endTime - $startTime; echo "Without compact time : $elapsed seconds\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 6
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 34
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 34
Branch analysis from position: 38
Branch analysis from position: 34
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 6
Branch analysis from position: 18
Branch analysis from position: 6
filename:       /in/WTrOJ
function name:  (null)
number of ops:  49
compiled vars:  !0 = $startTime, !1 = $i, !2 = $foo, !3 = $bar, !4 = $baz, !5 = $array, !6 = $endTime, !7 = $elapsed
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $8      
          3        ASSIGN                                                   !0, $8
    5     4        ASSIGN                                                   !1, 0
          5      > JMP                                                      ->16
    6     6    >   ASSIGN                                                   !2, 'foo'
    7     7        ASSIGN                                                   !3, 'bar'
    8     8        ASSIGN                                                   !4, 'baz'
   10     9        INIT_FCALL                                               'compact'
         10        SEND_VAL                                                 'foo'
         11        SEND_VAL                                                 'bar'
         12        SEND_VAL                                                 'baz'
         13        DO_ICALL                                         $14     
         14        ASSIGN                                                   !5, $14
    5    15        PRE_INC                                                  !1
         16    >   IS_SMALLER                                               !1, 100000
         17      > JMPNZ                                                    ~17, ->6
   13    18    >   INIT_FCALL                                               'microtime'
         19        SEND_VAL                                                 <true>
         20        DO_ICALL                                         $18     
         21        ASSIGN                                                   !6, $18
   14    22        SUB                                              ~20     !6, !0
         23        ASSIGN                                                   !7, ~20
   16    24        ROPE_INIT                                     3  ~23     'With+compact+%3A+'
         25        ROPE_ADD                                      1  ~23     ~23, !7
         26        ROPE_END                                      2  ~22     ~23, '+seconds%0A'
         27        ECHO                                                     ~22
   20    28        INIT_FCALL                                               'microtime'
         29        SEND_VAL                                                 <true>
         30        DO_ICALL                                         $25     
         31        ASSIGN                                                   !0, $25
   22    32        ASSIGN                                                   !1, 0
         33      > JMP                                                      ->36
   23    34    >   ASSIGN                                                   !5, <array>
   22    35        PRE_INC                                                  !1
         36    >   IS_SMALLER                                               !1, 100000
         37      > JMPNZ                                                    ~30, ->34
   30    38    >   INIT_FCALL                                               'microtime'
         39        SEND_VAL                                                 <true>
         40        DO_ICALL                                         $31     
         41        ASSIGN                                                   !6, $31
   31    42        SUB                                              ~33     !6, !0
         43        ASSIGN                                                   !7, ~33
   33    44        ROPE_INIT                                     3  ~36     'Without+compact+time+%3A+'
         45        ROPE_ADD                                      1  ~36     ~36, !7
         46        ROPE_END                                      2  ~35     ~36, '+seconds%0A'
         47        ECHO                                                     ~35
         48      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.9 ms | 1451 KiB | 15 Q