3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = [ "a" => 1, "b" => "hello", "c" => 5.5, "d" => true, ]; $y = new stdClass(); $y->a = 1; $y->b = "hello"; $y->c = 5.5; $y->d = true; $t1 = hrtime(true); for ($i = 0; $i < 6000000; $i++) { $a = $x["a"]; $b = $x["b"]; $c = $x["c"]; $d = $x["d"]; } $t2 = hrtime(true); $t3 = hrtime(true); for ($i = 0; $i < 6000000; $i++) { $a = $y->a; $b = $y->b; $c = $y->c; $d = $y->d; } $t4 = hrtime(true); echo "With array : " . (($t2 - $t1) / 1000000) . " ms\n"; echo "With object: " . (($t4 - $t3) / 1000000) . " ms\n"; class A { public $a; public $b; public $c; public $d; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 18
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 39
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 39
Branch analysis from position: 50
Branch analysis from position: 39
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 18
Branch analysis from position: 29
Branch analysis from position: 18
filename:       /in/3TBfX
function name:  (null)
number of ops:  65
compiled vars:  !0 = $x, !1 = $y, !2 = $t1, !3 = $i, !4 = $a, !5 = $b, !6 = $c, !7 = $d, !8 = $t2, !9 = $t3, !10 = $t4
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        NEW                                              $12     'stdClass'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $12
   11     4        ASSIGN_OBJ                                               !1, 'a'
          5        OP_DATA                                                  1
   12     6        ASSIGN_OBJ                                               !1, 'b'
          7        OP_DATA                                                  'hello'
   13     8        ASSIGN_OBJ                                               !1, 'c'
          9        OP_DATA                                                  5.5
   14    10        ASSIGN_OBJ                                               !1, 'd'
         11        OP_DATA                                                  <true>
   16    12        INIT_FCALL                                               'hrtime'
         13        SEND_VAL                                                 <true>
         14        DO_ICALL                                         $19     
         15        ASSIGN                                                   !2, $19
   17    16        ASSIGN                                                   !3, 0
         17      > JMP                                                      ->27
   18    18    >   FETCH_DIM_R                                      ~22     !0, 'a'
         19        ASSIGN                                                   !4, ~22
   19    20        FETCH_DIM_R                                      ~24     !0, 'b'
         21        ASSIGN                                                   !5, ~24
   20    22        FETCH_DIM_R                                      ~26     !0, 'c'
         23        ASSIGN                                                   !6, ~26
   21    24        FETCH_DIM_R                                      ~28     !0, 'd'
         25        ASSIGN                                                   !7, ~28
   17    26        PRE_INC                                                  !3
         27    >   IS_SMALLER                                               !3, 6000000
         28      > JMPNZ                                                    ~31, ->18
   23    29    >   INIT_FCALL                                               'hrtime'
         30        SEND_VAL                                                 <true>
         31        DO_ICALL                                         $32     
         32        ASSIGN                                                   !8, $32
   25    33        INIT_FCALL                                               'hrtime'
         34        SEND_VAL                                                 <true>
         35        DO_ICALL                                         $34     
         36        ASSIGN                                                   !9, $34
   26    37        ASSIGN                                                   !3, 0
         38      > JMP                                                      ->48
   27    39    >   FETCH_OBJ_R                                      ~37     !1, 'a'
         40        ASSIGN                                                   !4, ~37
   28    41        FETCH_OBJ_R                                      ~39     !1, 'b'
         42        ASSIGN                                                   !5, ~39
   29    43        FETCH_OBJ_R                                      ~41     !1, 'c'
         44        ASSIGN                                                   !6, ~41
   30    45        FETCH_OBJ_R                                      ~43     !1, 'd'
         46        ASSIGN                                                   !7, ~43
   26    47        PRE_INC                                                  !3
         48    >   IS_SMALLER                                               !3, 6000000
         49      > JMPNZ                                                    ~46, ->39
   32    50    >   INIT_FCALL                                               'hrtime'
         51        SEND_VAL                                                 <true>
         52        DO_ICALL                                         $47     
         53        ASSIGN                                                   !10, $47
   34    54        SUB                                              ~49     !8, !2
         55        DIV                                              ~50     ~49, 1000000
         56        CONCAT                                           ~51     'With+array+%3A+', ~50
         57        CONCAT                                           ~52     ~51, '+ms%0A'
         58        ECHO                                                     ~52
   35    59        SUB                                              ~53     !10, !9
         60        DIV                                              ~54     ~53, 1000000
         61        CONCAT                                           ~55     'With+object%3A+', ~54
         62        CONCAT                                           ~56     ~55, '+ms%0A'
         63        ECHO                                                     ~56
   43    64      > RETURN                                                   1

Class A: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.1 ms | 1441 KiB | 14 Q