3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Example { public $foo = "bar"; } $e = new Example(); var_dump(memory_get_usage(true)); // increase memory $e->foo = str_repeat($e->foo, 10000000); var_dump(memory_get_usage(true)); // no significant increase in memory because of copy-on-write $x = get_object_vars($e); var_dump(memory_get_usage(true)); // write happens, so a copy is made, so memory increases $x["foo"] = $x["foo"] . ""; var_dump(memory_get_usage(true));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aofDq
function name:  (null)
number of ops:  43
compiled vars:  !0 = $e, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $2      'Example'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    8     3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL                                               'memory_get_usage'
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $5      
          7        SEND_VAR                                                 $5
          8        DO_ICALL                                                 
   11     9        INIT_FCALL                                               'str_repeat'
         10        FETCH_OBJ_R                                      ~8      !0, 'foo'
         11        SEND_VAL                                                 ~8
         12        SEND_VAL                                                 10000000
         13        DO_ICALL                                         $9      
         14        ASSIGN_OBJ                                               !0, 'foo'
         15        OP_DATA                                                  $9
   12    16        INIT_FCALL                                               'var_dump'
         17        INIT_FCALL                                               'memory_get_usage'
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $10     
         20        SEND_VAR                                                 $10
         21        DO_ICALL                                                 
   15    22        INIT_FCALL                                               'get_object_vars'
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                         $12     
         25        ASSIGN                                                   !1, $12
   16    26        INIT_FCALL                                               'var_dump'
         27        INIT_FCALL                                               'memory_get_usage'
         28        SEND_VAL                                                 <true>
         29        DO_ICALL                                         $14     
         30        SEND_VAR                                                 $14
         31        DO_ICALL                                                 
   19    32        FETCH_DIM_R                                      ~17     !1, 'foo'
         33        CONCAT                                           ~18     ~17, ''
         34        ASSIGN_DIM                                               !1, 'foo'
         35        OP_DATA                                                  ~18
   20    36        INIT_FCALL                                               'var_dump'
         37        INIT_FCALL                                               'memory_get_usage'
         38        SEND_VAL                                                 <true>
         39        DO_ICALL                                         $19     
         40        SEND_VAR                                                 $19
         41        DO_ICALL                                                 
         42      > RETURN                                                   1

Class Example: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.33 ms | 1002 KiB | 17 Q