3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $value = 1; public $value2 = 1; private $properties; public function __construct() { } public function setProperties($properties) { $this->properties = $properties; } } $count = 10000; $a = new A(); $b = []; $m1 = memory_get_usage(); for ($i = 0; $i < $count; $i++) { $a->setProperties(1); } $m2 = memory_get_usage(); var_dump(['memory' => $m2 - $m1, 'perItem' => ($m2 - $m1) / $count]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 10
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 10
Branch analysis from position: 16
Branch analysis from position: 10
filename:       /in/qVRWF
function name:  (null)
number of ops:  28
compiled vars:  !0 = $count, !1 = $a, !2 = $b, !3 = $m1, !4 = $i, !5 = $m2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   ASSIGN                                                   !0, 10000
   23     1        NEW                                              $7      'A'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $7
   24     4        ASSIGN                                                   !2, <array>
   26     5        INIT_FCALL                                               'memory_get_usage'
          6        DO_ICALL                                         $11     
          7        ASSIGN                                                   !3, $11
   28     8        ASSIGN                                                   !4, 0
          9      > JMP                                                      ->14
   29    10    >   INIT_METHOD_CALL                                         !1, 'setProperties'
         11        SEND_VAL_EX                                              1
         12        DO_FCALL                                      0          
   28    13        PRE_INC                                                  !4
         14    >   IS_SMALLER                                               !4, !0
         15      > JMPNZ                                                    ~16, ->10
   32    16    >   INIT_FCALL                                               'memory_get_usage'
         17        DO_ICALL                                         $17     
         18        ASSIGN                                                   !5, $17
   34    19        INIT_FCALL                                               'var_dump'
         20        SUB                                              ~19     !5, !3
         21        INIT_ARRAY                                       ~20     ~19, 'memory'
         22        SUB                                              ~21     !5, !3
         23        DIV                                              ~22     ~21, !0
         24        ADD_ARRAY_ELEMENT                                ~20     ~22, 'perItem'
         25        SEND_VAL                                                 ~20
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

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

End of function __construct

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

End of function setproperties

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.79 ms | 1400 KiB | 17 Q