3v4l.org

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

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 3
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 3
Branch analysis from position: 12
Branch analysis from position: 3
filename:       /in/YgLFK
function name:  foo
number of ops:  14
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                                                      ->10
    5     3    >   INIT_FCALL                                               'pow'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $5      
          7        ASSIGN_DIM                                               !0
          8        OP_DATA                                                  $5
    4     9        PRE_INC                                                  !1
         10    >   IS_SMALLER                                               !1, 100000
         11      > JMPNZ                                                    ~7, ->3
    7    12    > > RETURN                                                   !0
    8    13*     > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.46 ms | 1403 KiB | 21 Q