3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Route { protected $path; public function __construct($path) { $this->path = $path; } } $routes = array(); $start = microtime(true); for($x = 0; $x < 100; $x++) { $routes[] = new Route("/a"); } echo sprintf("Class: Took %f ms\n", (microtime(true) - $start)); $routes2 = array(); $start = microtime(true); for($x = 0; $x < 100; $x++) { $routes2[] = (object)array( 'path' => '/a' ); } echo sprintf("stdClass: Took %f ms\n", (microtime(true) - $start)); $routes3 = array(); $start = microtime(true); for($x = 0; $x < 100; $x++) { $routes3[] = array( 'path' => '/a' ); } echo sprintf("array: Took %f ms\n", (microtime(true) - $start));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 7
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 31
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
2 jumps found. (Code = 44) Position 1 = 58, Position 2 = 53
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 53
2 jumps found. (Code = 44) Position 1 = 58, Position 2 = 53
Branch analysis from position: 58
Branch analysis from position: 53
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 31
Branch analysis from position: 37
Branch analysis from position: 31
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 7
Branch analysis from position: 15
Branch analysis from position: 7
filename:       /in/27ACL
function name:  (null)
number of ops:  68
compiled vars:  !0 = $routes, !1 = $start, !2 = $x, !3 = $routes2, !4 = $routes3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   13     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $6      
          4        ASSIGN                                                   !1, $6
   15     5        ASSIGN                                                   !2, 0
          6      > JMP                                                      ->13
   16     7    >   NEW                                              $10     'Route'
          8        SEND_VAL_EX                                              '%2Fa'
          9        DO_FCALL                                      0          
         10        ASSIGN_DIM                                               !0
         11        OP_DATA                                                  $10
   15    12        PRE_INC                                                  !2
         13    >   IS_SMALLER                                               !2, 100
         14      > JMPNZ                                                    ~13, ->7
   19    15    >   INIT_FCALL                                               'sprintf'
         16        SEND_VAL                                                 'Class%3A+Took+%25f+ms%0A'
         17        INIT_FCALL                                               'microtime'
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $14     
         20        SUB                                              ~15     $14, !1
         21        SEND_VAL                                                 ~15
         22        DO_ICALL                                         $16     
         23        ECHO                                                     $16
   21    24        ASSIGN                                                   !3, <array>
   23    25        INIT_FCALL                                               'microtime'
         26        SEND_VAL                                                 <true>
         27        DO_ICALL                                         $18     
         28        ASSIGN                                                   !1, $18
   24    29        ASSIGN                                                   !2, 0
         30      > JMP                                                      ->35
   26    31    >   CAST                                          8  ~22     <array>
   25    32        ASSIGN_DIM                                               !3
   26    33        OP_DATA                                                  ~22
   24    34        PRE_INC                                                  !2
         35    >   IS_SMALLER                                               !2, 100
         36      > JMPNZ                                                    ~24, ->31
   30    37    >   INIT_FCALL                                               'sprintf'
         38        SEND_VAL                                                 'stdClass%3A+Took+%25f+ms%0A'
         39        INIT_FCALL                                               'microtime'
         40        SEND_VAL                                                 <true>
         41        DO_ICALL                                         $25     
         42        SUB                                              ~26     $25, !1
         43        SEND_VAL                                                 ~26
         44        DO_ICALL                                         $27     
         45        ECHO                                                     $27
   32    46        ASSIGN                                                   !4, <array>
   34    47        INIT_FCALL                                               'microtime'
         48        SEND_VAL                                                 <true>
         49        DO_ICALL                                         $29     
         50        ASSIGN                                                   !1, $29
   35    51        ASSIGN                                                   !2, 0
         52      > JMP                                                      ->56
   36    53    >   ASSIGN_DIM                                               !4
   37    54        OP_DATA                                                  <array>
   35    55        PRE_INC                                                  !2
         56    >   IS_SMALLER                                               !2, 100
         57      > JMPNZ                                                    ~34, ->53
   41    58    >   INIT_FCALL                                               'sprintf'
         59        SEND_VAL                                                 'array%3A+Took+%25f+ms%0A'
         60        INIT_FCALL                                               'microtime'
         61        SEND_VAL                                                 <true>
         62        DO_ICALL                                         $35     
         63        SUB                                              ~36     $35, !1
         64        SEND_VAL                                                 ~36
         65        DO_ICALL                                         $37     
         66        ECHO                                                     $37
         67      > RETURN                                                   1

Class Route:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/27ACL
function name:  __construct
number of ops:  4
compiled vars:  !0 = $path
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        ASSIGN_OBJ                                               'path'
          2        OP_DATA                                                  !0
    8     3      > RETURN                                                   null

End of function __construct

End of class Route.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.45 ms | 1400 KiB | 17 Q