3v4l.org

run code in 300+ PHP versions simultaneously
$elapsed = microtime(true) - $start; var_dump($elapsed); $elapsed = microtime(true) - $start; var_dump($elapsed); <?php $a = range(0, 250_000); $b = range(250_000, 500_000); $start = microtime(true); foreach(array_merge($a, $b) as $key => $item){ // } $elapsed = microtime(true) - $start; var_dump($elapsed); $gen = function(array ...$input):iterable{foreach($input as $it) {yield from $it;}}; $start = microtime(true); foreach($gen($a, $b) as $key => $item){ // } $elapsed = microtime(true) - $start; var_dump($elapsed);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 23
2 jumps found. (Code = 77) Position 1 = 43, Position 2 = 46
Branch analysis from position: 43
2 jumps found. (Code = 78) Position 1 = 44, Position 2 = 46
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
Branch analysis from position: 23
filename:       /in/HMasj
function name:  (null)
number of ops:  56
compiled vars:  !0 = $a, !1 = $b, !2 = $start, !3 = $item, !4 = $key, !5 = $elapsed, !6 = $gen
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     '%24elapsed+%3D+microtime%28true%29+-+%24start%3B%0Avar_dump%28%24elapsed%29%3B%0A%0A%24elapsed+%3D+microtime%28true%29+-+%24start%3B%0Avar_dump%28%24elapsed%29%3B%0A%0A'
    9     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 0
          3        SEND_VAL                                                 250000
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !0, $7
   10     6        INIT_FCALL                                               'range'
          7        SEND_VAL                                                 250000
          8        SEND_VAL                                                 500000
          9        DO_ICALL                                         $9      
         10        ASSIGN                                                   !1, $9
   13    11        INIT_FCALL                                               'microtime'
         12        SEND_VAL                                                 <true>
         13        DO_ICALL                                         $11     
         14        ASSIGN                                                   !2, $11
   14    15        INIT_FCALL                                               'array_merge'
         16        SEND_VAR                                                 !0
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $13     
         19      > FE_RESET_R                                       $14     $13, ->23
         20    > > FE_FETCH_R                                       ~15     $14, !3, ->23
         21    >   ASSIGN                                                   !4, ~15
         22      > JMP                                                      ->20
         23    >   FE_FREE                                                  $14
   17    24        INIT_FCALL                                               'microtime'
         25        SEND_VAL                                                 <true>
         26        DO_ICALL                                         $17     
         27        SUB                                              ~18     $17, !2
         28        ASSIGN                                                   !5, ~18
   18    29        INIT_FCALL                                               'var_dump'
         30        SEND_VAR                                                 !5
         31        DO_ICALL                                                 
   20    32        DECLARE_LAMBDA_FUNCTION                          ~21     [0]
         33        ASSIGN                                                   !6, ~21
   22    34        INIT_FCALL                                               'microtime'
         35        SEND_VAL                                                 <true>
         36        DO_ICALL                                         $23     
         37        ASSIGN                                                   !2, $23
   23    38        INIT_DYNAMIC_CALL                                        !6
         39        SEND_VAR_EX                                              !0
         40        SEND_VAR_EX                                              !1
         41        DO_FCALL                                      0  $25     
         42      > FE_RESET_R                                       $26     $25, ->46
         43    > > FE_FETCH_R                                       ~27     $26, !3, ->46
         44    >   ASSIGN                                                   !4, ~27
         45      > JMP                                                      ->43
         46    >   FE_FREE                                                  $26
   26    47        INIT_FCALL                                               'microtime'
         48        SEND_VAL                                                 <true>
         49        DO_ICALL                                         $29     
         50        SUB                                              ~30     $29, !2
         51        ASSIGN                                                   !5, ~30
   27    52        INIT_FCALL                                               'var_dump'
         53        SEND_VAR                                                 !5
         54        DO_ICALL                                                 
         55      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 7
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 7
filename:       /in/HMasj
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $input, !1 = $it
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV_VARIADIC                                    !0      
          1        GENERATOR_CREATE                                         
          2      > FE_RESET_R                                       $2      !0, ->7
          3    > > FE_FETCH_R                                               $2, !1, ->7
          4    >   YIELD_FROM                                       ~3      !1
          5        FREE                                                     ~3
          6      > JMP                                                      ->3
          7    >   FE_FREE                                                  $2
          8      > GENERATOR_RETURN                                         

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.78 ms | 1434 KiB | 17 Q