title: Return multiple values from a method in a class
body: <p>I am trying to return multiple variables from a method. </p>
  
  <p>This is what I have tried so far:</p>
  
  <p>This code is the method in the class:</p>
  
  <pre><code>public function getUserInfo(){
  $stmt = $this-&gt;dbh-&gt;prepare("SELECT user_id FROM oopforum_users WHERE username = ?");
  $stmt-&gt;bindParam(1, $this-&gt;post_data['username']);
  $stmt-&gt;execute();
  
  while($row = $stmt-&gt;fetch(PDO::FETCH_ASSOC)) {
  
  $user_id = $row['user_id'];
  $thumb = $row['thumbnail'];
  }
  return array($user_id, $thumb);
  }
  </code></pre>
  
  <p>I attempt to place each variable in a list for use in the calling program:</p>
  
  <pre><code>session_start();
  require_once('init.php');
  
  $username = trim($_POST['username']);
  // create a new object
  $login = new Auth($_POST, $dbh);
  
      if($login-&gt;validateLogin()){
  
          $_SESSION['loggedin'] = true;
          list($user_id, $thumb) = $login-&gt;getUserInfo($user_id, $thumb);
          echo $user_id . ' ' . $thumb;
  
      }
  </code></pre>
  
  <p>This hasn't work.</p>
  
  <p>How can I return an array of multiple variables from a method within a class for use in the calling program?</p>