PHP Interview Questions And Answers For 2 Years Experience

What is PHP?

PHP (Hyper text Pre Processor) is a scripting language commonly used for web applications. PHP can be easily embedded in HTML. PHP generally runs on a web server. It is available for free and can be used across a variety of servers, operating systems and platforms.What are the differences between GET and POST methods in form submitting, give the case where we can use get and we can use post methods?On the server side, the main difference between GET and POST is where the submitted is stored. The $_GET array stores data submitted by the GET method. The $_POST array stores data submitted by the POST method. On the browser side, the difference is that data submitted by the GET method will be displayed in the browser’s address field. Data submitted by the POST method will not be displayed anywhere on the browser. GET method is mostly used for submitting a small amount and less sensitive data. POST method is mostly used for submitting a large amount or sensitive data.Who is the father of php and explain the changes in php versions?Rasmus Lerdorf for version changes go to Marco Tabini is the founder and publisher of php|architect.How can we submit from without a submit button?We can use a simple JavaScript code linked to an event trigger of any form field. In the JavaScript code, we can call the document.form.submit() function to submit the form.How many ways we can retrieve the date in result set of mysql Using php?As individual objects so single record or as a set or arrays.What is the difference between $message and $$message?They are both variables. But $message is a variable with a fixed name. $$message is a variable who’s name is stored in $message. For example, if $message contains “var”, $$message is the same as $var.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.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.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.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.What are the current versions of apache, php, and mysql?PHP: php 5.3 
MySQL: MySQL 5.5 
Apache: Apache 2.2

Author: admin

Leave a Reply