Top PHP Interview Questions
1Q. Define PHP.
Ans. PHP stands for Hypertext Preprocessor. It is an open source server-side scripting language, widely used for web development.
2Q. What PHP stands for ?
Ans. PHP stands for Hypertext Preprocessor.
3Q. Who is known as the father of PHP?
Ans. Rasmus Lerdorf is known as father of PHP.
4Q. Which programming language does PHP resemble?
Ans. PHP syntax resembles Perl and C language.
5Q. What was the old name of PHP?
Ans. The old name of PHP was Personal Home Page.
6Q. What is PEAR in PHP?
Ans. PEAR is a PHP Extension and Application Repository. It is a framework and repository for reusable PHP components. It consists of all types of PHP code snippets and libraries.
7Q. What is the name of scripting engine in PHP?
Ans. The scripting engine that powers PHP is known as Zend Engine 2.
8Q. Is PHP a case-sensitive language?
Ans. PHP is a partial case-sensitive language. The variable names are completely case-sensitive but the function names are not. And the user-defined functions are not case-sensitive but the rest of the language is case-sensitive.
9Q. What are the popular frameworks in PHP?
Ans. The popular frameworks in PHP are :-
1. CakePHP
2. CodeIgniter
3. Yii 2
4.. Symfony
5. Zend Framework etc.
10Q. What is the purpose of @ in PHP?
Ans. In PHP, the @ is used for suppressing the error messages. If any runtime error occurs on the line which consists @ symbol at the beginning, then that error will be handled by PHP.
11Q. What is needed to be able to use image function?
Ans. GD library is needed to execute the image functions.
12Q. How can PHP and HTML interact?
Ans. We can generate HTML through PHP scripts, and it is also possible to pass pieces of information from HTML to PHP.
13Q. How can PHP and Javascript interact?
Ans. The PHP and Javascript cannot interact directly as PHP is a server side language and Javascript is a client-side language. However, we can exchange variables because PHP can generate Javascript code to be executed by the browser and it is possible to pass specific variables back to PHP via the URL.
14Q. What are the different loops in PHP?
Ans. The loops in PHP are For, while, do-while and for each.
15Q. What are the types of array in PHP?
Ans. There are 3 types of array in PHP:
1. Indexed array: an array with a numeric key.
2. Associative array: an array where each key has its specific value.
3. Multidimensional array: an array containing one or more arrays within itself.