Accessing fopen from a class in PHP -


for reason i'm having trouble accessing fopen() function inside class in php:

<?php      class compare     {         function __construct( ){  }          private $q_scores = array();          private $q_path = "./data/questions.txt";          private $questions = fopen($q_path, 'r');             //...      }  ?> 

how access built-in php functions inside class?

many thanks

put line in constructor (it's made this)

$this->questions = fopen($this->q_path, 'r');   

and declare like:

private $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 -