3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $array = []; public function __construct() { $i = 0; while ($i < 10) { $this->array[$i] = str_repeat(" ", 1e6); $i++; } } public function &variables() { return $this->array; } } echo xdebug_memory_usage() . "\n"; $test = new Test(); echo xdebug_memory_usage() . "\n"; $vars = $test->variables(); echo xdebug_memory_usage() . "\n"; array_search("test", $vars); echo xdebug_memory_usage() . "\n"; //echo xdebug_debug_zval("vars") . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nOi4Y
function name:  (null)
number of ops:  27
compiled vars:  !0 = $test, !1 = $vars
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL_BY_NAME                                       'xdebug_memory_usage'
          1        DO_FCALL                                      0  $2      
          2        CONCAT                                           ~3      $2, '%0A'
          3        ECHO                                                     ~3
   21     4        NEW                                              $4      'Test'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $4
   22     7        INIT_FCALL_BY_NAME                                       'xdebug_memory_usage'
          8        DO_FCALL                                      0  $7      
          9        CONCAT                                           ~8      $7, '%0A'
         10        ECHO                                                     ~8
   23    11        INIT_METHOD_CALL                                         !0, 'variables'
         12        DO_FCALL                                      0  $9      
         13        ASSIGN                                                   !1, $9
   24    14        INIT_FCALL_BY_NAME                                       'xdebug_memory_usage'
         15        DO_FCALL                                      0  $11     
         16        CONCAT                                           ~12     $11, '%0A'
         17        ECHO                                                     ~12
   26    18        INIT_FCALL                                               'array_search'
         19        SEND_VAL                                                 'test'
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                                 
   28    22        INIT_FCALL_BY_NAME                                       'xdebug_memory_usage'
         23        DO_FCALL                                      0  $14     
         24        CONCAT                                           ~15     $14, '%0A'
         25        ECHO                                                     ~15
   29    26      > RETURN                                                   1

Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 2
Branch analysis from position: 12
Branch analysis from position: 2
filename:       /in/nOi4Y
function name:  __construct
number of ops:  13
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, 0
    9     1      > JMP                                                      ->10
   10     2    >   INIT_FCALL                                               'str_repeat'
          3        SEND_VAL                                                 '+'
          4        SEND_VAL                                                 1.0e+6
          5        DO_ICALL                                         $4      
          6        FETCH_OBJ_W                                      $2      'array'
          7        ASSIGN_DIM                                               $2, !0
          8        OP_DATA                                                  $4
   11     9        PRE_INC                                                  !0
    9    10    >   IS_SMALLER                                               !0, 10
         11      > JMPNZ                                                    ~6, ->2
   13    12    > > RETURN                                                   null

End of function __construct

Function variables:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/nOi4Y
function name:  variables
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   FETCH_OBJ_W                                      $0      'array'
          1      > RETURN_BY_REF                                            $0
   17     2*     > RETURN_BY_REF                                            null

End of function variables

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.01 ms | 1400 KiB | 17 Q