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
Post a Comment