title: "Function not defined" error
body: <p>I have a class which is :</p>
  
  <pre><code>&lt;?php
  class FileObject{
  
          private $name;
          private $arr;
  
          function __construct($name){
  
              $this-&gt;name = $name;
          $arr = array();
  
          }
  
  
          public function readFile(){
          $fileHandler = fopen($this-&gt;name, "rb");
  
          while (!feof($fileHandler) ) {
  
  $line_of_text = fgets($fileHandler);
  $parts = explode(' ', $line_of_text);
  $count = 0;
  foreach($parts as $tokens){
  $arr[$tokens] = $count;
  $count++;
  }
  }
  
  if(checkInArr("fox"))
  echo "yes";
  else
  echo "no";
  
  ksort($arr);
  print_r($arr);
  fclose($fileHandler);
          }
  
          function checkInArr($needle){
  
              if(array_key_exists($needle,$arr))
              return TRUE;
              else
              return FALSE;
  
          }
  
  }
  
  ?&gt;
  </code></pre>
  
  <p>and I'm getting this error:</p>
  
  <blockquote>
    <p><code>Fatal error: Call to undefined function checkInArr() in
    C:\wamp\www\jbglobal\file_lib.php on line 29</code></p>
  </blockquote>
  
  <p>Any ideas why?</p>