Problem accessing text file in a class in PHP -


i have code:

<?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->questions = fopen($this->q_path, 'r');           }          public function checkstringforproximity($string)         {             while ($line = fgets($questions))             {                 echo $line;             }         }      }  ?> 

this relates prev. question: accessing fopen class in php

the problem $line never prints , don't know why.

i use class using:

$compare = new compare();  $compare->checkstringforproximity("string"); 

any appreciated.

in line

while ($line = fgets($questions)) 

$questions not exist. should replaced $this->questions


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -