My function works outside of the class but not from within the class
<p>I feel like I'm missing something obvious here. I have a class as follows:</p>

<pre><code>&lt;?php

class files
{
public function getDirectoryList($directory)
{
    // create an array to hold directory list
    $results = array();

    // create a handler for the directory
    $handler = opendir($directory);

    // open directory and walk through the filenames
    while($file = readdir($handler)) 
    {

        // if the file isn't this directory or the parent, add it to the results.
        if($file != "." &amp;&amp; $file != "..")
        {
            $results[] = $file;
        }
    }

    // tidy up: close the handler
    closedir($handler);

    //done
    return $results;
}
}

?&gt;
</code></pre>

<p>Now I have the class included into another file and I'm doing the following:</p>

<pre><code>$fileListing = new files();
$fileListing-&gt;getDirectoryList('education');
</code></pre>

<p>I'm not getting any results back. If I take the function out of the class and put it in this file, I can get results by doing:</p>

<pre><code>$fileListing = getDirectoryList('education');
</code></pre>
