Problem accessing text file in a class in PHP
<p>I have this code:</p>

<pre><code>&lt;?php

    class Compare
    {
        private $questions;

        private $q_scores = array();

        private $q_path = "data/questions.txt";

        function __construct( )
        {  
            ini_set('auto_detect_line_endings', TRUE); 
            $this-&gt;questions = fopen($this-&gt;q_path, 'r');  
        }

        public function checkStringForProximity($string)
        {
            while ($line = fgets($questions))
            {
                echo $line;
            }
        }

    }

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

<p>This relates to my prev. question: <a href="http://stackoverflow.com/questions/6770170/accessing-fopen-from-a-class-in-php">Accessing fopen from a class in PHP</a></p>

<p>The problem is that <code>$line</code> never prints and I don't know why. </p>

<p>I use this class by using:</p>

<pre><code>$compare = new Compare();

$compare-&gt;checkStringForProximity("string");
</code></pre>

<p>Any help much appreciated.</p>
