title: Can I store a class instance in a $_SESSION space?
body: <pre><code> Class User{
  
  public $id;
  public $username;
  public $password;
  public $email;
  public $steam;
  public $donator;
  public $active;
  
  public function __construct($username, $email, $password, $id, $active, $donator, $steam){
      $this-&gt;id = $id;
      $this-&gt;username = $username;
      $this-&gt;password = $password;
      $this-&gt;email = $email;
      $this-&gt;steam = $steam;
      $this-&gt;donator = $donator;
      $this-&gt;active = $active;
  }}
  </code></pre>
  
  <p>is my class (simplified) </p>
  
  <p>the following is my code:</p>
  
  <pre><code>$_SESSION['loggedIn'] = $user;
  </code></pre>
  
  <p>$user is a class instance of User</p>
  
  <p>now this is what print_r($_SESSION['loggedIn']) shows me:</p>
  
  <pre><code>    __PHP_Incomplete_Class Object
  (
      [__PHP_Incomplete_Class_Name] =&gt; User
      [id] =&gt; 22
      [username] =&gt; xxxx
      [password] =&gt; xxxx
      [email] =&gt; xxxx
      [steam] =&gt; 1234567
      [donator] =&gt; 0
      [active] =&gt; 1
  )
  </code></pre>
  
  <p>in which xxxx are values that are correct.</p>
  
  <p>but when i try to retrieve data from my session. like so: "$_SESSION['loggedIn']->username" it returns a null value to me.</p>