3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $foo; public function __construct($foo) { $this->foo = $foo; } private function bar() { echo 'Accessed the private method.'; } public function baz(Test $other) { // We can change the private property: $other->foo = 'hello'; echo $other->foo; // We can also call the private method: $other->bar(); } public function getFoo(){ return $this->foo; } } $test = new Test('test'); $test->baz(new Test('other')); echo $test->getFoo(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iG9sD
function name:  (null)
number of ops:  14
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   NEW                                              $1      'Test'
          1        SEND_VAL_EX                                              'test'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   34     4        INIT_METHOD_CALL                                         !0, 'baz'
          5        NEW                                              $4      'Test'
          6        SEND_VAL_EX                                              'other'
          7        DO_FCALL                                      0          
          8        SEND_VAR_NO_REF_EX                                       $4
          9        DO_FCALL                                      0          
   36    10        INIT_METHOD_CALL                                         !0, 'getFoo'
         11        DO_FCALL                                      0  $7      
         12        ECHO                                                     $7
   37    13      > RETURN                                                   1

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

End of function __construct

Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iG9sD
function name:  bar
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ECHO                                                     'Accessed+the+private+method.'
   14     1      > RETURN                                                   null

End of function bar

Function baz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iG9sD
function name:  baz
number of ops:  8
compiled vars:  !0 = $other
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   19     1        ASSIGN_OBJ                                               !0, 'foo'
          2        OP_DATA                                                  'hello'
   20     3        FETCH_OBJ_R                                      ~2      !0, 'foo'
          4        ECHO                                                     ~2
   23     5        INIT_METHOD_CALL                                         !0, 'bar'
          6        DO_FCALL                                      0          
   24     7      > RETURN                                                   null

End of function baz

Function getfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iG9sD
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

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
193.52 ms | 1399 KiB | 13 Q