PHP Interview Question and Answer for Experience

PHP : 2+ Years Experience Interview Question and Answer


7.) What are the differences between require and include, include_once?

File will not be included more than once. If we want to include a file once only and further calling of the file will be ignored then we have to use the PHP function include_once(). This will prevent problems with function redefinitions, variable value reassignments, etc.

8.) What are the different tables present in mysql?

Total 5 types of tables we can create

  1. MyISAM 
  2. Heap 
  3. Merge 
  4. InnoDB 
  5. ISAM 
  6. BDB 

MyISAM is the default storage engine as of MySQL 3.23.

9.) How can I execute a php script using command line?

Just run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line argument. For example, "php myScript.php", assuming "php" is the command to invoke the CLI program.

Be aware that if your PHP script was written for the Web CGI interface, it may not execute properly in command line environment.

10.) What is meant by nl2br()?

Nl2br Inserts HTML line breaks before all newlines in a string string nl2br (string); For example: echo nl2br("god bless you")

will output "god bless you" to your browser.

11.) What are the current versions of apache, php, and mysql?

PHP: php 5.3
MySQL: MySQL 5.5
Apache: Apache 2.2

12.) What are the reasons for selecting lamp (Linux, apache, mysql, php) instead of combination of other software programs, servers and operating systems?

All of those are open source resource. Security of linux is very very more than windows. Apache is a better server that IIS both in functionality and security. Mysql is world most popular open source database. PHP is more faster that asp or any other scripting language.


1 2 3 4 5 6 7 8