3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function __construct(private Bar $bar, private string $_value = 'foo') {} public function __get(string $name) { return match($name) { 'value' => $this->_value, }; } public function __set(string $name, string $value) { switch ($name) { case 'value': $this->bar->doSomething($this); $this->_value = $value; } } } class Bar { public function doSomething(Foo $foo): void { $oldValue = $foo->value; } } $foo = new Foo(new Bar()); $foo->value = 'bar';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3pUtD
function name:  (null)
number of ops:  9
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   NEW                                              $1      'Foo'
          1        NEW                                              $2      'Bar'
          2        DO_FCALL                                      0          
          3        SEND_VAR_NO_REF_EX                                       $2
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   28     6        ASSIGN_OBJ                                               !0, 'value'
          7        OP_DATA                                                  'bar'
          8      > RETURN                                                   1

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

End of function __construct

Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
1 jumps found. (Code = 197) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3pUtD
function name:  __get
number of ops:  10
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        IS_IDENTICAL                                             !0, 'value'
          2      > JMPNZ                                                    ~1, ->5
          3    > > JMP                                                      ->4
          4    > > MATCH_ERROR                                              !0
          5    >   FETCH_OBJ_R                                      ~2      '_value'
          6        QM_ASSIGN                                        ~3      ~2
          7      > JMP                                                      ->8
          8    > > RETURN                                                   ~3
   10     9*     > RETURN                                                   null

End of function __get

Function __set:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3pUtD
function name:  __set
number of ops:  13
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2        IS_EQUAL                                                 !0, 'value'
          3      > JMPNZ                                                    ~2, ->5
          4    > > JMP                                                      ->12
   15     5    >   FETCH_OBJ_R                                      ~3      'bar'
          6        INIT_METHOD_CALL                                         ~3, 'doSomething'
          7        FETCH_THIS                                       $4      
          8        SEND_VAR_EX                                              $4
          9        DO_FCALL                                      0          
   16    10        ASSIGN_OBJ                                               '_value'
         11        OP_DATA                                                  !1
   18    12    > > RETURN                                                   null

End of function __set

End of class Foo.

Class Bar:
Function dosomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3pUtD
function name:  doSomething
number of ops:  4
compiled vars:  !0 = $foo, !1 = $oldValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   23     1        FETCH_OBJ_R                                      ~2      !0, 'value'
          2        ASSIGN                                                   !1, ~2
   24     3      > RETURN                                                   null

End of function dosomething

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.68 ms | 1000 KiB | 13 Q