PHP Interview Questions
This page contains PHP interview questions and answers.
__construct
and __destruct
method in PHPEvery class in PHP gets a Constructor __construct
method and Destructor __destruct
method by default if it is not explicitly defined.
The Constructor method is executed immediately after the creation of an instance of the class.
We use constructor method to initialise the properties of the class object.
The Destructor method is called when all references to the class object are removed or explicitly destroyed.
We use the destructor method to release any resources that we have acquired during code execution. Example, closing of database connection or closing of file resource.
For this we can use the empty
function.
The following code will print error message if both the email and password submitted is empty.
if (empty($_POST['email']) && empty($_POST['password'])) {
echo 'Email and Password both are empty.';
}
PEAR or PHP Extension and Application Repository is a framework and distributed system of reusable PHP components.
It is a structured library of open source PHP code for developers.
PSR stands for PHP Standards Recommendations and it is a set of recommendations for writing PHP code.
PHP was initially called Personal Home Page.
PHP now stands for PHP: Hypertext Preprocessor
.
The scripting engine powering PHP is called Zend Engine.
Rasmus Lerdorf created PHP.
Following are some of the popular Content Management System CMS written in PHP.
Following are some of the popular PHP framework.
ADVERTISEMENT