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<10000;$i++) { $a = clone $c; $a->klucz = 'wartosc'.$i; $a->hash = md5(microtime(true)); } $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 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 12
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 12
Branch analysis from position: 28
Branch analysis from position: 12
filename:       /in/bBKUE
function name:  (null)
number of ops:  44
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                                                      ->26
   20    12    >   CLONE                                            ~17     !2
         13        ASSIGN                                                   !4, ~17
   21    14        CONCAT                                           ~20     'wartosc', !3
         15        ASSIGN_OBJ                                               !4, 'klucz'
         16        OP_DATA                                                  ~20
   22    17        INIT_FCALL                                               'md5'
         18        INIT_FCALL                                               'microtime'
         19        SEND_VAL                                                 <true>
         20        DO_ICALL                                         $22     
         21        SEND_VAR                                                 $22
         22        DO_ICALL                                         $23     
         23        ASSIGN_OBJ                                               !4, 'hash'
         24        OP_DATA                                                  $23
   19    25        PRE_INC                                                  !3
         26    >   IS_SMALLER                                               !3, 10000
         27      > JMPNZ                                                    ~25, ->12
   26    28    >   INIT_FCALL                                               'microtime'
         29        SEND_VAL                                                 <true>
         30        DO_ICALL                                         $26     
         31        ASSIGN                                                   !5, $26
   27    32        INIT_FCALL                                               'memory_get_usage'
         33        DO_ICALL                                         $28     
         34        ASSIGN                                                   !6, $28
   28    35        SUB                                              ~30     !5, !0
         36        ASSIGN                                                   !7, ~30
   29    37        SUB                                              ~32     !6, !1
         38        ASSIGN                                                   !8, ~32
   31    39        INIT_FCALL                                               'var_dump'
         40        SEND_VAR                                                 !7
         41        SEND_VAR                                                 !8
         42        DO_ICALL                                                 
         43      > RETURN                                                   1

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bBKUE
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/bBKUE
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/bBKUE
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:
150.77 ms | 1400 KiB | 21 Q