PHP Interview Questions – Set 02

What was the old name of PHP?

The old name of PHP was Personal Home Page.

What is the use of count() function in PHP?

The PHP count() function is used to count total elements in the array, or something an object.

Which programming language does PHP resemble to?

PHP has borrowed its syntax from Perl and C.

What is the difference between $message and $$message?

$message stores variable data while $$message is used to store variable of variables.

$message stores fixed data whereas the data stored in $$message may be changed dynamically.

Explain the difference b/w static and dynamic websites?

In static websitescontent can’t be changed after running the script. You can’t change anything on the site. It is predefined.

In dynamic websitescontent 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.

What are the ways to define a constant in PHP?

PHP constants are name or identifier that can’t be changed during execution of the script. PHP constants are defined in two ways:

  • Using define() function
  • Using const() function

What is the use of header() function in PHP?

The header() function is used to send a raw HTTP header to a client. It must be called before sending the actual output. For example, you can’t print any HTML element before using this function.

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

What is the name of scripting engine in PHP?

The scripting engine that powers PHP is called Zend Engine 2.

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.