I'm still new to PHP and I am having a lot of trouble. I'm used to languages like C,C++, and Java, and this one is kinda confusing me. Basically my problem is that I have the following code:
class File_Reader
{
protected $text;
public function Scan_File (){}
public function Skip_Whitespace(&$current_pos)
{
//skip past whitespace at the start
while (($current_pos < strlen($text) && ($text[$current_pos] == ' ')))
$current_pos++;
}
public function __construct(&$file_text)
{
$text = $file_text;
}
}
class Times_File_Reader extends File_Reader
{
Public Function Scan_File()
{
$errors = array();
$times = array();
$current_time;
$cursor = 0;
$line = 0;
while ($cursor < strlen($text))
{
Skip_Whitespace($cursor);
//....lots more code here...
return $times;
}
}
}
but when I try to run it, it tells me that $time and Skip_Whitespace are both undefined. I don't understand, they should have been inherited. I tried putting an echo command in the File_Reader constructor and it does enter the constructor when I create my Times_File_Reader.
Oh, and for completeness, here is where I declare my Times_File_Reader:
include 'File_Readers.php';
$text = file_get_contents("01_CT.txt");
$reader = new Times_File_Reader($text);
$array = $reader->Scan_File();
I've been searching for an answer for hours to no avail, and deadline is approaching quickly. Any help would be appreciated. Thank you!