Friday, 15 September 2017

php syntax error, unexpected T_VARIABLE

code:



public function isQuestion($query){

$questions = $this->getAllQuestions();


if (count($questions)){
foreach ($questions as $q){
if ($this->isQuestion$q($query)){
return $this->isQuestion$q($query);
}
}
}

return false;

}


error:



Parse error: syntax error, unexpected T_VARIABLE in /Applications/XAMPP/xamppfiles/htdocs/ai/application/models/question_model.php on line 7


the problem occurs on




if ($this->isQuestion$q($query)){

return $this->isQuestion$q($query);


i have some functions like isQuestion1, isQuestion2, isQuestion3 etc... and i call another function *getAllQuestions* that will return me all the numbers of the questions in an array like 1,2,3,4,5... then i use the above code to check if each function is a question based on a query

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...