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 = array(); public function __construct($Username) { $this->Messages = array(); $this->Messages[] = "Message 1"; $this->Messages[] = "Message 2"; } } $Username = "Username"; $Password = "Password"; $theUser = User::Login("Poopy", "Butt"); echo $theUser->Username; echo $theUser->Password; echo $theUser->$Username; echo $theUser->$Password; print_r($theUser->Inbox->Messages); var_dump(get_object_vars($theUser)); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N1hUc
function name:  (null)
number of ops:  27
compiled vars:  !0 = $Username, !1 = $Password, !2 = $theUser
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   ASSIGN                                                   !0, 'Username'
   32     1        ASSIGN                                                   !1, 'Password'
   33     2        INIT_STATIC_METHOD_CALL                                  'User', 'Login'
          3        SEND_VAL                                                 'Poopy'
          4        SEND_VAL                                                 'Butt'
          5        DO_FCALL                                      0  $5      
          6        ASSIGN                                                   !2, $5
   34     7        FETCH_OBJ_R                                      ~7      !2, 'Username'
          8        ECHO                                                     ~7
   35     9        FETCH_OBJ_R                                      ~8      !2, 'Password'
         10        ECHO                                                     ~8
   36    11        FETCH_OBJ_R                                      ~9      !2, !0
         12        ECHO                                                     ~9
   37    13        FETCH_OBJ_R                                      ~10     !2, !1
         14        ECHO                                                     ~10
   38    15        INIT_FCALL                                               'print_r'
         16        FETCH_OBJ_R                                      ~11     !2, 'Inbox'
         17        FETCH_OBJ_R                                      ~12     ~11, 'Messages'
         18        SEND_VAL                                                 ~12
         19        DO_ICALL                                                 
   39    20        INIT_FCALL                                               'var_dump'
         21        INIT_FCALL                                               'get_object_vars'
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                         $14     
         24        SEND_VAR                                                 $14
         25        DO_ICALL                                                 
   40    26      > RETURN                                                   1

Class User:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N1hUc
function name:  __construct
number of ops:  12
compiled vars:  !0 = $Username, !1 = $Password
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                                              $5      'Inbox'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        ASSIGN_OBJ                                               'Inbox'
         10        OP_DATA                                                  $5
   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/N1hUc
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/N1hUc
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:
146.56 ms | 1405 KiB | 19 Q