3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $data = 'some data'; } class Bar { private readonly string $data; public function __construct(string $data) { $this->data = $data; } } $foo = new Foo(); $bar = new Bar('some data'); (fn() => $this->data = 'other data')->call($foo); //(fn() => $this->data = 'other data')->call($bar); $foo2 = (fn() => $this->data)->call($foo); //$bar2 = (fn() => $this->data)->call($bar); echo $foo2; //echo $bar2;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BUvSi
function name:  (null)
number of ops:  18
compiled vars:  !0 = $foo, !1 = $bar, !2 = $foo2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $3      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   17     3        NEW                                              $6      'Bar'
          4        SEND_VAL_EX                                              'some+data'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $6
   19     7        DECLARE_LAMBDA_FUNCTION                          ~9      [0]
          8        INIT_METHOD_CALL                                         ~9, 'call'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0          
   21    11        DECLARE_LAMBDA_FUNCTION                          ~11     [1]
         12        INIT_METHOD_CALL                                         ~11, 'call'
         13        SEND_VAR_EX                                              !0
         14        DO_FCALL                                      0  $12     
         15        ASSIGN                                                   !2, $12
   24    16        ECHO                                                     !2
   26    17      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BUvSi
function name:  {closure}
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_THIS                                       $0      
          1        ASSIGN_OBJ                                       ~1      $0, 'data'
          2        OP_DATA                                                  'other+data'
          3      > RETURN                                                   ~1
          4*     > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BUvSi
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   FETCH_THIS                                       $0      
          1        FETCH_OBJ_R                                      ~1      $0, 'data'
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of Dynamic Function 1

Class Foo: [no user functions]
Class Bar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BUvSi
function name:  __construct
number of ops:  4
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        ASSIGN_OBJ                                               'data'
          2        OP_DATA                                                  !0
   12     3      > RETURN                                                   null

End of function __construct

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.53 ms | 1002 KiB | 13 Q