3v4l.org

run code in 300+ PHP versions simultaneously
<?php class cat {public $name = "";public function setName($name) {$this->name = $name; }public function getName() {return $this->name; } }$rover = new cat();for ($x=0; $x<10; $x++) { $t = microtime(true);for ($i=0; $i<1000000; $i++) { $rover->setName("rover");$n = $rover->getName();}echo microtime(true) - $t;echo "\n";} class dog { public $name = "";} $rover = new dog(); for ($x=0; $x<10; $x++) { $t = microtime(true); for ($i=0; $i<1000000; $i++) { $rover->name = "rover"; $n = $rover->name;} echo microtime(true) - $t;echo "\n";}
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 = 5
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
2 jumps found. (Code = 44) Position 1 = 56, Position 2 = 34
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 40
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 56, Position 2 = 34
Branch analysis from position: 56
Branch analysis from position: 34
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 40
Branch analysis from position: 47
Branch analysis from position: 40
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 11
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 5
Branch analysis from position: 29
Branch analysis from position: 5
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 11
Branch analysis from position: 20
Branch analysis from position: 11
filename:       /in/LT4OU
function name:  (null)
number of ops:  57
compiled vars:  !0 = $rover, !1 = $x, !2 = $t, !3 = $i, !4 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $5      'cat'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $5
          3        ASSIGN                                                   !1, 0
          4      > JMP                                                      ->27
          5    >   INIT_FCALL                                               'microtime'
          6        SEND_VAL                                                 <true>
          7        DO_ICALL                                         $9      
          8        ASSIGN                                                   !2, $9
          9        ASSIGN                                                   !3, 0
         10      > JMP                                                      ->18
         11    >   INIT_METHOD_CALL                                         !0, 'setName'
         12        SEND_VAL_EX                                              'rover'
         13        DO_FCALL                                      0          
         14        INIT_METHOD_CALL                                         !0, 'getName'
         15        DO_FCALL                                      0  $13     
         16        ASSIGN                                                   !4, $13
         17        PRE_INC                                                  !3
         18    >   IS_SMALLER                                               !3, 1000000
         19      > JMPNZ                                                    ~16, ->11
         20    >   INIT_FCALL                                               'microtime'
         21        SEND_VAL                                                 <true>
         22        DO_ICALL                                         $17     
         23        SUB                                              ~18     $17, !2
         24        ECHO                                                     ~18
         25        ECHO                                                     '%0A'
         26        PRE_INC                                                  !1
         27    >   IS_SMALLER                                               !1, 10
         28      > JMPNZ                                                    ~20, ->5
    5    29    >   NEW                                              $21     'dog'
         30        DO_FCALL                                      0          
         31        ASSIGN                                                   !0, $21
         32        ASSIGN                                                   !1, 0
         33      > JMP                                                      ->54
         34    >   INIT_FCALL                                               'microtime'
         35        SEND_VAL                                                 <true>
         36        DO_ICALL                                         $25     
         37        ASSIGN                                                   !2, $25
         38        ASSIGN                                                   !3, 0
         39      > JMP                                                      ->45
         40    >   ASSIGN_OBJ                                               !0, 'name'
         41        OP_DATA                                                  'rover'
         42        FETCH_OBJ_R                                      ~29     !0, 'name'
         43        ASSIGN                                                   !4, ~29
         44        PRE_INC                                                  !3
         45    >   IS_SMALLER                                               !3, 1000000
         46      > JMPNZ                                                    ~32, ->40
         47    >   INIT_FCALL                                               'microtime'
         48        SEND_VAL                                                 <true>
         49        DO_ICALL                                         $33     
         50        SUB                                              ~34     $33, !2
         51        ECHO                                                     ~34
         52        ECHO                                                     '%0A'
         53        PRE_INC                                                  !1
         54    >   IS_SMALLER                                               !1, 10
         55      > JMPNZ                                                    ~36, ->34
         56    > > RETURN                                                   1

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

End of function setname

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

End of function getname

End of class cat.

Class dog: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.99 ms | 1400 KiB | 15 Q