3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { $foo = array(); for($x = 0; $x < 10000; $x++){ $foo[] = rand(); } return $foo; } $t = microtime(true); for($x=0;$x<100000; $x++){ foreach(foo() as $val){ $val = $val + 2; } } echo round(microtime(true) - $t, 5)."\n"; $t = microtime(true); for($x=0;$x<100000; $x++){ $foo = foo(); foreach($foo as $val){ $val = $val + 2; } } echo round(microtime(true) - $t, 5)."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 6
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 33
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
2 jumps found. (Code = 77) Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
2 jumps found. (Code = 78) Position 1 = 38, Position 2 = 41
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 33
Branch analysis from position: 45
Branch analysis from position: 33
Branch analysis from position: 41
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 6
Branch analysis from position: 17
Branch analysis from position: 6
Branch analysis from position: 13
filename:       /in/DN7NA
function name:  (null)
number of ops:  56
compiled vars:  !0 = $t, !1 = $x, !2 = $val, !3 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $4      
          3        ASSIGN                                                   !0, $4
   12     4        ASSIGN                                                   !1, 0
          5      > JMP                                                      ->15
   13     6    >   INIT_FCALL                                               'foo'
          7        DO_FCALL                                      0  $7      
          8      > FE_RESET_R                                       $8      $7, ->13
          9    > > FE_FETCH_R                                               $8, !2, ->13
   14    10    >   ADD                                              ~9      !2, 2
         11        ASSIGN                                                   !2, ~9
   13    12      > JMP                                                      ->9
         13    >   FE_FREE                                                  $8
   12    14        PRE_INC                                                  !1
         15    >   IS_SMALLER                                               !1, 100000
         16      > JMPNZ                                                    ~12, ->6
   17    17    >   INIT_FCALL                                               'round'
         18        INIT_FCALL                                               'microtime'
         19        SEND_VAL                                                 <true>
         20        DO_ICALL                                         $13     
         21        SUB                                              ~14     $13, !0
         22        SEND_VAL                                                 ~14
         23        SEND_VAL                                                 5
         24        DO_ICALL                                         $15     
         25        CONCAT                                           ~16     $15, '%0A'
         26        ECHO                                                     ~16
   21    27        INIT_FCALL                                               'microtime'
         28        SEND_VAL                                                 <true>
         29        DO_ICALL                                         $17     
         30        ASSIGN                                                   !0, $17
   22    31        ASSIGN                                                   !1, 0
         32      > JMP                                                      ->43
   23    33    >   INIT_FCALL                                               'foo'
         34        DO_FCALL                                      0  $20     
         35        ASSIGN                                                   !3, $20
   24    36      > FE_RESET_R                                       $22     !3, ->41
         37    > > FE_FETCH_R                                               $22, !2, ->41
   25    38    >   ADD                                              ~23     !2, 2
         39        ASSIGN                                                   !2, ~23
   24    40      > JMP                                                      ->37
         41    >   FE_FREE                                                  $22
   22    42        PRE_INC                                                  !1
         43    >   IS_SMALLER                                               !1, 100000
         44      > JMPNZ                                                    ~26, ->33
   28    45    >   INIT_FCALL                                               'round'
         46        INIT_FCALL                                               'microtime'
         47        SEND_VAL                                                 <true>
         48        DO_ICALL                                         $27     
         49        SUB                                              ~28     $27, !0
         50        SEND_VAL                                                 ~28
         51        SEND_VAL                                                 5
         52        DO_ICALL                                         $29     
         53        CONCAT                                           ~30     $29, '%0A'
         54        ECHO                                                     ~30
         55      > RETURN                                                   1

Function foo:
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 = 62) Position 1 = -2
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/DN7NA
function name:  foo
number of ops:  12
compiled vars:  !0 = $foo, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->8
    5     3    >   INIT_FCALL                                               'rand'
          4        DO_ICALL                                         $5      
          5        ASSIGN_DIM                                               !0
          6        OP_DATA                                                  $5
    4     7        PRE_INC                                                  !1
          8    >   IS_SMALLER                                               !1, 10000
          9      > JMPNZ                                                    ~7, ->3
    7    10    > > RETURN                                                   !0
    8    11*     > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.29 ms | 1403 KiB | 21 Q