3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Email { public function __construct( public string $value ) {} } class Message { public function __construct( private Email $recipient ) {} public function recipient(): Email { return $this->recipient; } } $address = new Email('foo@bar.com'); $message = new Message($address); var_dump($message); $message->recipient()->value = 'oops'; var_dump($message);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tJmY8
function name:  (null)
number of ops:  20
compiled vars:  !0 = $address, !1 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $2      'Email'
          1        SEND_VAL_EX                                              'foo%40bar.com'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   23     4        NEW                                              $5      'Message'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $5
   25     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
   27    11        INIT_METHOD_CALL                                         !1, 'recipient'
         12        DO_FCALL                                      0  $9      
         13        SEPARATE                                         $9      $9
         14        ASSIGN_OBJ                                               $9, 'value'
         15        OP_DATA                                                  'oops'
   29    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

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

End of function __construct

End of class Email.

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

End of function __construct

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

End of function recipient

End of class Message.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.06 ms | 1003 KiB | 14 Q