3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test1() { $s = microtime(true); for ($i = 0; $i < 1000000; $i++) { } return microtime(true) - $s; } function test2() { $s = microtime(true); $i = 0; while ($i < 1000000) { $i++; } return microtime(true) - $s; } function test3() { $s = microtime(true); $i = 0; while ($i++ < 1000000) { } return microtime(true) - $s; } echo test1() . "\n\n"; echo test2() . "\n\n"; echo test3() . "\n\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oMbYl
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   INIT_FCALL                                               'test1'
          1        DO_FCALL                                      0  $0      
          2        CONCAT                                           ~1      $0, '%0A%0A'
          3        ECHO                                                     ~1
   30     4        INIT_FCALL                                               'test2'
          5        DO_FCALL                                      0  $2      
          6        CONCAT                                           ~3      $2, '%0A%0A'
          7        ECHO                                                     ~3
   31     8        INIT_FCALL                                               'test3'
          9        DO_FCALL                                      0  $4      
         10        CONCAT                                           ~5      $4, '%0A%0A'
         11        ECHO                                                     ~5
         12      > RETURN                                                   1

Function test1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 6
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 6
Branch analysis from position: 9
Branch analysis from position: 6
filename:       /in/oMbYl
function name:  test1
number of ops:  15
compiled vars:  !0 = $s, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $2      
          3        ASSIGN                                                   !0, $2
    5     4        ASSIGN                                                   !1, 0
          5      > JMP                                                      ->7
          6    >   PRE_INC                                                  !1
          7    >   IS_SMALLER                                               !1, 1000000
          8      > JMPNZ                                                    ~6, ->6
    8     9    >   INIT_FCALL                                               'microtime'
         10        SEND_VAL                                                 <true>
         11        DO_ICALL                                         $7      
         12        SUB                                              ~8      $7, !0
         13      > RETURN                                                   ~8
    9    14*     > RETURN                                                   null

End of function test1

Function test2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 6
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 6
Branch analysis from position: 9
Branch analysis from position: 6
filename:       /in/oMbYl
function name:  test2
number of ops:  15
compiled vars:  !0 = $s, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $2      
          3        ASSIGN                                                   !0, $2
   13     4        ASSIGN                                                   !1, 0
   14     5      > JMP                                                      ->7
   15     6    >   PRE_INC                                                  !1
   14     7    >   IS_SMALLER                                               !1, 1000000
          8      > JMPNZ                                                    ~6, ->6
   17     9    >   INIT_FCALL                                               'microtime'
         10        SEND_VAL                                                 <true>
         11        DO_ICALL                                         $7      
         12        SUB                                              ~8      $7, !0
         13      > RETURN                                                   ~8
   18    14*     > RETURN                                                   null

End of function test2

Function test3:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 6
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/oMbYl
function name:  test3
number of ops:  15
compiled vars:  !0 = $s, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $2      
          3        ASSIGN                                                   !0, $2
   22     4        ASSIGN                                                   !1, 0
   23     5      > JMP                                                      ->6
          6    >   POST_INC                                         ~5      !1
          7        IS_SMALLER                                               ~5, 1000000
          8      > JMPNZ                                                    ~6, ->6
   26     9    >   INIT_FCALL                                               'microtime'
         10        SEND_VAL                                                 <true>
         11        DO_ICALL                                         $7      
         12        SUB                                              ~8      $7, !0
         13      > RETURN                                                   ~8
   27    14*     > RETURN                                                   null

End of function test3

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.86 ms | 1394 KiB | 20 Q