3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Mutable { private $x; public function __construct(int $x) { $this->x = $x; } public function setX(int $x): void { $this->x = $x; } public function x(): int { return $this->x; } } final class User { private $m; public function __construct(Mutable $m) { $this->m = $m; } public function x(): void { echo "{$this->m->x()}\n"; } } $m = new Mutable(42); $u = new User($m); $u->x(); $m->setX(-1); $u->x();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EZRdP
function name:  (null)
number of ops:  16
compiled vars:  !0 = $m, !1 = $u
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   NEW                                              $2      'Mutable'
          1        SEND_VAL_EX                                              42
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   32     4        NEW                                              $5      'User'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $5
   34     8        INIT_METHOD_CALL                                         !1, 'x'
          9        DO_FCALL                                      0          
   35    10        INIT_METHOD_CALL                                         !0, 'setX'
         11        SEND_VAL_EX                                              -1
         12        DO_FCALL                                      0          
   36    13        INIT_METHOD_CALL                                         !1, 'x'
         14        DO_FCALL                                      0          
         15      > RETURN                                                   1

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

End of function __construct

Function setx:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EZRdP
function name:  setX
number of ops:  4
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        ASSIGN_OBJ                                               'x'
          2        OP_DATA                                                  !0
   12     3      > RETURN                                                   null

End of function setx

Function x:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EZRdP
function name:  x
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   FETCH_OBJ_R                                      ~0      'x'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   16     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function x

End of class Mutable.

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

End of function __construct

Function x:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EZRdP
function name:  x
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   FETCH_OBJ_R                                      ~0      'm'
          1        INIT_METHOD_CALL                                         ~0, 'x'
          2        DO_FCALL                                      0  $1      
          3        NOP                                                      
          4        FAST_CONCAT                                      ~2      $1, '%0A'
          5        ECHO                                                     ~2
   28     6      > RETURN                                                   null

End of function x

End of class User.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.41 ms | 1399 KiB | 13 Q