3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { protected $a; public function getA() { return $this->a; } public function setA($a) { $this->a = $a; } } $test = new Test; $test->setA("foo"); $someArray = array(); $start_time = MICROTIME(TRUE); for ($i=1; $i<=10000; $i++) { if ('' !== ($foo = $test->getA())) { $someArray[] = $foo; } } $stop_time = MICROTIME(TRUE); $time = $stop_time - $start_time; echo "Elapsed time was $time seconds."; $start_time2 = MICROTIME(TRUE); for ($i=1; $i<=10000; $i++) { if ('' !== ($foo = $test->getA())) { $someArray[] = $foo; } unset($foo); } $stop_time2 = MICROTIME(TRUE); $time2 = $stop_time2 - $start_time2; echo "Elapsed time was $time2 seconds."; $start_time3 = MICROTIME(TRUE); for ($i=1; $i<=10000; $i++) { if ('' !== $test->getA()) { $someArray[] = $test->getA(); } } $stop_time3 = MICROTIME(TRUE); $time3 = $stop_time3 - $start_time3; echo "Elapsed time was $time3 seconds.";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 13
Branch analysis from position: 23
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 = 42) Position 1 = 75
Branch analysis from position: 75
2 jumps found. (Code = 44) Position 1 = 77, Position 2 = 66
Branch analysis from position: 77
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 66
2 jumps found. (Code = 43) Position 1 = 70, Position 2 = 74
Branch analysis from position: 70
2 jumps found. (Code = 44) Position 1 = 77, Position 2 = 66
Branch analysis from position: 77
Branch analysis from position: 66
Branch analysis from position: 74
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 46
Branch analysis from position: 44
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: 46
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 13
Branch analysis from position: 23
Branch analysis from position: 13
Branch analysis from position: 20
filename:       /in/fanmQ
function name:  (null)
number of ops:  88
compiled vars:  !0 = $test, !1 = $someArray, !2 = $start_time, !3 = $i, !4 = $foo, !5 = $stop_time, !6 = $time, !7 = $start_time2, !8 = $stop_time2, !9 = $time2, !10 = $start_time3, !11 = $stop_time3, !12 = $time3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $13     'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $13
   10     3        INIT_METHOD_CALL                                         !0, 'setA'
          4        SEND_VAL_EX                                              'foo'
          5        DO_FCALL                                      0          
   12     6        ASSIGN                                                   !1, <array>
   14     7        INIT_FCALL                                               'microtime'
          8        SEND_VAL                                                 <true>
          9        DO_ICALL                                         $18     
         10        ASSIGN                                                   !2, $18
   15    11        ASSIGN                                                   !3, 1
         12      > JMP                                                      ->21
   16    13    >   INIT_METHOD_CALL                                         !0, 'getA'
         14        DO_FCALL                                      0  $21     
         15        ASSIGN                                           ~22     !4, $21
         16        IS_NOT_IDENTICAL                                         ~22, ''
         17      > JMPZ                                                     ~23, ->20
   17    18    >   ASSIGN_DIM                                               !1
         19        OP_DATA                                                  !4
   15    20    >   PRE_INC                                                  !3
         21    >   IS_SMALLER_OR_EQUAL                                      !3, 10000
         22      > JMPNZ                                                    ~26, ->13
   20    23    >   INIT_FCALL                                               'microtime'
         24        SEND_VAL                                                 <true>
         25        DO_ICALL                                         $27     
         26        ASSIGN                                                   !5, $27
   21    27        SUB                                              ~29     !5, !2
         28        ASSIGN                                                   !6, ~29
   22    29        ROPE_INIT                                     3  ~32     'Elapsed+time+was+'
         30        ROPE_ADD                                      1  ~32     ~32, !6
         31        ROPE_END                                      2  ~31     ~32, '+seconds.'
         32        ECHO                                                     ~31
   26    33        INIT_FCALL                                               'microtime'
         34        SEND_VAL                                                 <true>
         35        DO_ICALL                                         $34     
         36        ASSIGN                                                   !7, $34
   27    37        ASSIGN                                                   !3, 1
         38      > JMP                                                      ->48
   28    39    >   INIT_METHOD_CALL                                         !0, 'getA'
         40        DO_FCALL                                      0  $37     
         41        ASSIGN                                           ~38     !4, $37
         42        IS_NOT_IDENTICAL                                         ~38, ''
         43      > JMPZ                                                     ~39, ->46
   29    44    >   ASSIGN_DIM                                               !1
         45        OP_DATA                                                  !4
   31    46    >   UNSET_CV                                                 !4
   27    47        PRE_INC                                                  !3
         48    >   IS_SMALLER_OR_EQUAL                                      !3, 10000
         49      > JMPNZ                                                    ~42, ->39
   33    50    >   INIT_FCALL                                               'microtime'
         51        SEND_VAL                                                 <true>
         52        DO_ICALL                                         $43     
         53        ASSIGN                                                   !8, $43
   34    54        SUB                                              ~45     !8, !7
         55        ASSIGN                                                   !9, ~45
   35    56        ROPE_INIT                                     3  ~48     'Elapsed+time+was+'
         57        ROPE_ADD                                      1  ~48     ~48, !9
         58        ROPE_END                                      2  ~47     ~48, '+seconds.'
         59        ECHO                                                     ~47
   38    60        INIT_FCALL                                               'microtime'
         61        SEND_VAL                                                 <true>
         62        DO_ICALL                                         $50     
         63        ASSIGN                                                   !10, $50
   39    64        ASSIGN                                                   !3, 1
         65      > JMP                                                      ->75
   40    66    >   INIT_METHOD_CALL                                         !0, 'getA'
         67        DO_FCALL                                      0  $53     
         68        IS_NOT_IDENTICAL                                         $53, ''
         69      > JMPZ                                                     ~54, ->74
   41    70    >   INIT_METHOD_CALL                                         !0, 'getA'
         71        DO_FCALL                                      0  $56     
         72        ASSIGN_DIM                                               !1
         73        OP_DATA                                                  $56
   39    74    >   PRE_INC                                                  !3
         75    >   IS_SMALLER_OR_EQUAL                                      !3, 10000
         76      > JMPNZ                                                    ~58, ->66
   44    77    >   INIT_FCALL                                               'microtime'
         78        SEND_VAL                                                 <true>
         79        DO_ICALL                                         $59     
         80        ASSIGN                                                   !11, $59
   45    81        SUB                                              ~61     !11, !10
         82        ASSIGN                                                   !12, ~61
   46    83        ROPE_INIT                                     3  ~64     'Elapsed+time+was+'
         84        ROPE_ADD                                      1  ~64     ~64, !12
         85        ROPE_END                                      2  ~63     ~64, '+seconds.'
         86        ECHO                                                     ~63
         87      > RETURN                                                   1

Class Test:
Function geta:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fanmQ
function name:  getA
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FETCH_OBJ_R                                      ~0      'a'
          1      > RETURN                                                   ~0
          2*     > RETURN                                                   null

End of function geta

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

End of function seta

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.9 ms | 1404 KiB | 15 Q