3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $bar; } class Friend extends Foo { public $bar; function __construct(Foo $foo) { (function (Foo $foo) { $this->bar = & $foo->bar; })->bindTo($this, 'Foo')->__invoke($foo); $this->bar = & $foo->bar; } } $foo = new Foo(); $friend = new Friend($foo); var_dump($foo); $friend->bar = 'baz'; var_dump($foo);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VoVST
function name:  (null)
number of ops:  16
compiled vars:  !0 = $foo, !1 = $friend
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   19     3        NEW                                              $5      'Friend'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $5
   21     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
   23    10        ASSIGN_OBJ                                               !1, 'bar'
         11        OP_DATA                                                  'baz'
   25    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FVoVST%3A10%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VoVST
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        FETCH_THIS                                       $1      
          2        FETCH_OBJ_W                                      $3      !0, 'bar'
          3        MAKE_REF                                         $4      $3
          4        ASSIGN_OBJ_REF                                           $1, 'bar'
          5        OP_DATA                                                  $4
   12     6      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FVoVST%3A10%240

Class Foo: [no user functions]
Class Friend:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VoVST
function name:  __construct
number of ops:  15
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FVoVST%3A10%240'
   12     2        INIT_METHOD_CALL                                         ~1, 'bindTo'
          3        FETCH_THIS                                       $2      
          4        SEND_VAR_EX                                              $2
          5        SEND_VAL_EX                                              'Foo'
          6        DO_FCALL                                      0  $3      
          7        INIT_METHOD_CALL                                         $3, '__invoke'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
   14    10        FETCH_OBJ_W                                      $6      !0, 'bar'
         11        MAKE_REF                                         $7      $6
         12        ASSIGN_OBJ_REF                                           'bar'
         13        OP_DATA                                                  $7
   15    14      > RETURN                                                   null

End of function __construct

End of class Friend.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.33 ms | 1400 KiB | 15 Q