I have two PHP scripts, dispatcher.php
and processor.php
(there are more, but I've commented the others out because they're not necessary at the moment).
I get the following error:
Parse error: syntax error, unexpected '$this' (T_VARIABLE) in /----home directory-----/classes/processor.php on line 12
Here's the code for processor.php:
class Processor{
protected $player;
protected $name;
protected $id;
function __construct(){
}
function loadvars($request){
$this->loadvar($this->name, $request, "name");
}
private function loadvar($target, $request, $name){
if(isset($request[$name])){
$target = $request[$name];
}
else{
$target = "";
}
}
}
this is the code for dispatcher.php:
require('classes/processor.php');
$test = new Processor();
$test->loadvars($_GET);
I don't see why this error occurs?
I'm coding using Sublime on Windows, if that matters.