3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $count; public function __construct() { $this->count = 1; } public function addCount() { $this->count++; } } class Bar { private $foo; private $array; public function __construct() { $this->foo = new Foo; $this->array = array(1, 2, 3); } public function getFoo() { return $this->foo; } public function getArray() { return $this->array; } } $bar = new Bar; $foo = $bar->getFoo(); $array = $bar->getArray(); var_dump($bar->getFoo()); print '<br>'; var_dump($foo); print '<br>'; var_dump($bar->getArray()); print '<br>'; var_dump($array); print '<br>'; $foo->addCount(); $array[] = 4; var_dump($bar->getFoo()); print '<br>'; var_dump($foo); print '<br>'; var_dump($bar->getArray()); print '<br>'; var_dump($array); print '<br>';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dY7rl
function name:  (null)
number of ops:  54
compiled vars:  !0 = $bar, !1 = $foo, !2 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   NEW                                              $3      'Bar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   36     3        INIT_METHOD_CALL                                         !0, 'getFoo'
          4        DO_FCALL                                      0  $6      
          5        ASSIGN                                                   !1, $6
   37     6        INIT_METHOD_CALL                                         !0, 'getArray'
          7        DO_FCALL                                      0  $8      
          8        ASSIGN                                                   !2, $8
   39     9        INIT_FCALL                                               'var_dump'
         10        INIT_METHOD_CALL                                         !0, 'getFoo'
         11        DO_FCALL                                      0  $10     
         12        SEND_VAR                                                 $10
         13        DO_ICALL                                                 
   40    14        ECHO                                                     '%3Cbr%3E'
   41    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
   42    18        ECHO                                                     '%3Cbr%3E'
   43    19        INIT_FCALL                                               'var_dump'
         20        INIT_METHOD_CALL                                         !0, 'getArray'
         21        DO_FCALL                                      0  $13     
         22        SEND_VAR                                                 $13
         23        DO_ICALL                                                 
   44    24        ECHO                                                     '%3Cbr%3E'
   45    25        INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                                 
   46    28        ECHO                                                     '%3Cbr%3E'
   48    29        INIT_METHOD_CALL                                         !1, 'addCount'
         30        DO_FCALL                                      0          
   49    31        ASSIGN_DIM                                               !2
         32        OP_DATA                                                  4
   51    33        INIT_FCALL                                               'var_dump'
         34        INIT_METHOD_CALL                                         !0, 'getFoo'
         35        DO_FCALL                                      0  $18     
         36        SEND_VAR                                                 $18
         37        DO_ICALL                                                 
   52    38        ECHO                                                     '%3Cbr%3E'
   53    39        INIT_FCALL                                               'var_dump'
         40        SEND_VAR                                                 !1
         41        DO_ICALL                                                 
   54    42        ECHO                                                     '%3Cbr%3E'
   55    43        INIT_FCALL                                               'var_dump'
         44        INIT_METHOD_CALL                                         !0, 'getArray'
         45        DO_FCALL                                      0  $21     
         46        SEND_VAR                                                 $21
         47        DO_ICALL                                                 
   56    48        ECHO                                                     '%3Cbr%3E'
   57    49        INIT_FCALL                                               'var_dump'
         50        SEND_VAR                                                 !2
         51        DO_ICALL                                                 
   58    52        ECHO                                                     '%3Cbr%3E'
         53      > RETURN                                                   1

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

End of function __construct

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

End of function addcount

End of class Foo.

Class Bar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dY7rl
function name:  __construct
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN_OBJ                                               'foo'
          3        OP_DATA                                                  $1
   23     4        ASSIGN_OBJ                                               'array'
          5        OP_DATA                                                  <array>
   24     6      > RETURN                                                   null

End of function __construct

Function getfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dY7rl
function name:  getFoo
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   FETCH_OBJ_R                                      ~0      'foo'
          1      > RETURN                                                   ~0
   28     2*     > RETURN                                                   null

End of function getfoo

Function getarray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dY7rl
function name:  getArray
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   FETCH_OBJ_R                                      ~0      'array'
          1      > RETURN                                                   ~0
   32     2*     > RETURN                                                   null

End of function getarray

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.99 ms | 1404 KiB | 15 Q