Wednesday 22 June 2016

php - Parse error: "syntax error, unexpected ';', expecting T_FUNCTION"



Sample Code:



Config.php:
class Config {
public $serverIP = "1.1.1.10";
}

DB.php:

require_once "/home/mysite/PHP/Config.php";
class DB extends Config {
//DB related functions here..
}

research.php:
require_once "/home/mysite/PHP/DB.php";
class research extends DB {
// Using DB functions to retrieve information from the research tables.
}



On executing the research.php file, I am getting an error message saying:



 "Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /home/mysite/PHP/research.php on line 1". 


I have checked every possibility that may cause this error. But I couldn't fix it. I have checked few possibilities such as require_once("filepath"); missing braces, etc...


Answer



This is on line 1, which you didn't post




Be sure you have space between and first code


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...