Below are the updated PHP Interview Question, that has been asked in many companies. All The Best.
1) What is PHP?
PHP stands for Hypertext Preprocessor. It is an open source server-side scripting language which is widely used for web development. It supports many databases like MySQL, Oracle, Sybase, Solid, PostgreSQL, generic ODBC etc
2) What is PEAR in PHP?
PEAR is a framework and repository for reusable PHP components. PEAR stands for PHP Extension and Application Repository. It contains all types of PHP code snippets and libraries.
It also provides a command line interface to install “packages” automatically.
3) Who is known as the father of PHP?
4) What was the old name of PHP?
Personal Home Page.
5) Explain the difference b/w static and dynamic websites?
In static websites, content can’t be changed after running the script. You can’t change anything in the site. It is predefined.
In dynamic websites, content of script can be changed at the run time. Its content is regenerated every time a user visit or reload. Google, yahoo and every search engine is the example of dynamic website.
6) What is the name of scripting engine in PHP?
The scripting engine that powers PHP is called Zend Engine 2.
7) Explain the difference between PHP4 and PHP5.
PHP4 doesn’t support oops concept and uses Zend Engine 1.
PHP5 supports oops concept and uses Zend Engine 2.
8) What are the popular Content Management Systems (CMS) in PHP?
- Drupal etc.
9) What are the popular frameworks in PHP?
- Yii 2
- Zend Framework etc.
10) Which programming language does PHP resemble to?
PHP has borrowed its syntax from Perl and C.
11) List some of the features of PHP7.
- Scalar type declarations
- Return type declarations
- Null coalescing operator (??)
- Spaceship operator
- Constant arrays using define()
- Anonymous classes
- Closure::call method
- Group use declaration
- Generator return expressions
- Generator delegation
- Space ship operator
12) What is “echo” in PHP?
PHP echo output one or more string. It is a language construct not a function. So use of parentheses is not required. But if you want to pass more than one parameter to echo, use of parentheses is required.
- void echo ( string $arg1 [, string $… ] )
13) What is “print” in PHP?
PHP print output a string. It is a language construct not a function. So use of parentheses is not required with the argument list. Unlike echo, it always returns 1.
- int print ( string $arg)
14) What is the difference between “echo” and “print” in PHP?
Echo can output one or more string but print can only output one string and always returns 1.
Echo is faster than print because it does not return any value.
15) How a variable is declared in PHP?
PHP variable is a name of memory location that holds data. It is a temporary storage.