3v4l.org

run code in 300+ PHP versions simultaneously
<?php class User { public $Username; public $Password; public $Inbox; private function __construct($Username, $Password) { $this->Username = $Username; $this->Password = $Password; $this->$Inbox = new Inbox($Username); } public static function Login($Username, $Password) { return new User($Username, $Password); } } class Inbox { public $Messages; public function __construct($Username) { $this->Messages = array(); $this->Messages[] = "Message 1"; $this->Messages[] = "Message 2"; } } $theUser = User::Login("Poopy", "Butt"); echo $theUser->Username; echo $theUser->Password; print_r($theUser->Inbox->Messages); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K1XF2
function name:  (null)
number of ops:  15
compiled vars:  !0 = $theUser
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   INIT_STATIC_METHOD_CALL                                  'User', 'Login'
          1        SEND_VAL                                                 'Poopy'
          2        SEND_VAL                                                 'Butt'
          3        DO_FCALL                                      0  $1      
          4        ASSIGN                                                   !0, $1
   32     5        FETCH_OBJ_R                                      ~3      !0, 'Username'
          6        ECHO                                                     ~3
   33     7        FETCH_OBJ_R                                      ~4      !0, 'Password'
          8        ECHO                                                     ~4
   34     9        INIT_FCALL                                               'print_r'
         10        FETCH_OBJ_R                                      ~5      !0, 'Inbox'
         11        FETCH_OBJ_R                                      ~6      ~5, 'Messages'
         12        SEND_VAL                                                 ~6
         13        DO_ICALL                                                 
   36    14      > RETURN                                                   1

Class User:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K1XF2
function name:  __construct
number of ops:  12
compiled vars:  !0 = $Username, !1 = $Password, !2 = $Inbox
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        ASSIGN_OBJ                                               'Username'
          3        OP_DATA                                                  !0
   11     4        ASSIGN_OBJ                                               'Password'
          5        OP_DATA                                                  !1
   12     6        NEW                                              $6      'Inbox'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        ASSIGN_OBJ                                               !2
         10        OP_DATA                                                  $6
   13    11      > RETURN                                                   null

End of function __construct

Function login:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K1XF2
function name:  Login
number of ops:  8
compiled vars:  !0 = $Username, !1 = $Password
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2        NEW                                              $2      'User'
          3        SEND_VAR_EX                                              !0
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0          
          6      > RETURN                                                   $2
   17     7*     > RETURN                                                   null

End of function login

End of class User.

Class Inbox:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K1XF2
function name:  __construct
number of ops:  10
compiled vars:  !0 = $Username
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
   25     1        ASSIGN_OBJ                                               'Messages'
          2        OP_DATA                                                  <array>
   26     3        FETCH_OBJ_W                                      $2      'Messages'
          4        ASSIGN_DIM                                               $2
          5        OP_DATA                                                  'Message+1'
   27     6        FETCH_OBJ_W                                      $4      'Messages'
          7        ASSIGN_DIM                                               $4
          8        OP_DATA                                                  'Message+2'
   28     9      > RETURN                                                   null

End of function __construct

End of class Inbox.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.65 ms | 1405 KiB | 15 Q