title: Undefined variable:
body: <p>I got these two errors in my code:</p>
  
  <blockquote>
    <p>Notice: Undefined variable: p1 in C:\Program Files
    (x86)\Zend\Apache2\htdocs\ttt.php on line 61</p>
    
    <p>Notice: Trying to get property of non-object in C:\Program Files
    (x86)\Zend\Apache2\htdocs\ttt.php on line 61 It is 's turn:</p>
  </blockquote>
  
  <p>The relevant code is here:</p>
  
  <pre><code>//this is within the Board object
  function updateBoard(){ 
      if($this-&gt;xTurn == True){
          echo "It is " . $p1-&gt;username . "'s turn: "; //line 61
      } elseif($this-&gt;xTurn == False){
          echo "It is " . $p2-&gt;username . "'s turn: ";
      }
  }
  
  //This is within the Player object
  function __construct($name){
      $this-&gt;username = $name;
  }
  
  $a   = new Board();
  $p1  = new Player($name);
  $p2  = new Player($name);
  $new = new Game();
  $a-&gt;updateBoard
  </code></pre>
  
  <p>Whenever I run this, it doesn't echo $p1->username. Any thoughts on how to fix this because I have no idea at this point.</p>
  
  <p>Update: Woops. I left out some important code. </p>