3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $vars = array(); public function __construct() {} public function __get($id) { return array_key_exists($id, $this->vars) ? $this->vars[$id] : null; } public function __set($id, $val) { $this->vars[$id] = $val; } } $ta = microtime(true); $ma = memory_get_usage(); $c = new A(); for ($i=0;$i<1000;$i++) { $a = clone $c; $a->klucz = 'wartosc'.$i; } $tb = microtime(true); $mb = memory_get_usage(); $tc = $tb-$ta; $mc = $mb-$ma; var_dump($tc, $mc);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 12
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 12
Branch analysis from position: 20
Branch analysis from position: 12
filename:       /in/jMkFs
function name:  (null)
number of ops:  36
compiled vars:  !0 = $ta, !1 = $ma, !2 = $c, !3 = $i, !4 = $a, !5 = $tb, !6 = $mb, !7 = $tc, !8 = $mc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $9      
          3        ASSIGN                                                   !0, $9
   15     4        INIT_FCALL                                               'memory_get_usage'
          5        DO_ICALL                                         $11     
          6        ASSIGN                                                   !1, $11
   17     7        NEW                                              $13     'A'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !2, $13
   19    10        ASSIGN                                                   !3, 0
         11      > JMP                                                      ->18
   20    12    >   CLONE                                            ~17     !2
         13        ASSIGN                                                   !4, ~17
   21    14        CONCAT                                           ~20     'wartosc', !3
         15        ASSIGN_OBJ                                               !4, 'klucz'
         16        OP_DATA                                                  ~20
   19    17        PRE_INC                                                  !3
         18    >   IS_SMALLER                                               !3, 1000
         19      > JMPNZ                                                    ~22, ->12
   25    20    >   INIT_FCALL                                               'microtime'
         21        SEND_VAL                                                 <true>
         22        DO_ICALL                                         $23     
         23        ASSIGN                                                   !5, $23
   26    24        INIT_FCALL                                               'memory_get_usage'
         25        DO_ICALL                                         $25     
         26        ASSIGN                                                   !6, $25
   27    27        SUB                                              ~27     !5, !0
         28        ASSIGN                                                   !7, ~27
   28    29        SUB                                              ~29     !6, !1
         30        ASSIGN                                                   !8, ~29
   30    31        INIT_FCALL                                               'var_dump'
         32        SEND_VAR                                                 !7
         33        SEND_VAR                                                 !8
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

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

End of function __construct

Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jMkFs
function name:  __get
number of ops:  11
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        FETCH_OBJ_R                                      ~1      'vars'
          2        ARRAY_KEY_EXISTS                                         !0, ~1
          3      > JMPZ                                                     ~2, ->8
          4    >   FETCH_OBJ_R                                      ~3      'vars'
          5        FETCH_DIM_R                                      ~4      ~3, !0
          6        QM_ASSIGN                                        ~5      ~4
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~5      null
          9    > > RETURN                                                   ~5
    8    10*     > RETURN                                                   null

End of function __get

Function __set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jMkFs
function name:  __set
number of ops:  6
compiled vars:  !0 = $id, !1 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        FETCH_OBJ_W                                      $2      'vars'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   11     5      > RETURN                                                   null

End of function __set

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.63 ms | 1400 KiB | 19 Q