- World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.

Get it now !!
Send your Resume to 6000 Companies
PHP Interview Questions & Answers - Learning Mode

PHP Interview Questions & Answers - Learning Mode

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language. Originally created by Rasmus Lerdorf in 1994, the PHP reference implementation is now produced by The PHP Group. PHP originally stood for Personal Home Page, but it now stands for the recursive backronym PHP: Hypertext Preprocessor.

Try PHP Interview Questions & Answers - Exam Mode

1 2 3 4 5 6 7 Next

Sort By : Latest First | Oldest First | By Rating

PHP Interview Questions & Answers - Learning Mode
Try PHP Interview Questions & Answers - Exam Mode
Question: How i can make a chat page in php in simple

Answer: First of all we have to make one .txt file ...then open it in write mode then write something in messsage box that will written in that file ...the another user also open that file and write the file with the mesage box....Also open the file in read mod in side window to see what the another user is write ...IN this way we can make simple chat file with php Source:
Question: What is difference between require_once(), require(), include().
Becouse above three function usely use to call a file in another file.

Answer: Difference between require() and require_once(): require() includes and evaluates a specific file, while require_once() does that only if it has not been included before (on the same page).
So, require_once() is recommended to use when you want to include a file where you have a lot of functions for example. This way you make sure you don't include the file more times and you will not get the "function re-declared" error.

Difference between require() and include() is that require( Source:
Question: Difference between mysql_connect and mysql_pconnect.

Answer: There is a good page in the php manual on the subject, in short mysql_pconnect() makes a persistent connection to the database which means a SQL link that do not close when the execution of your script ends. Source:
Question: How to handle drop down box change event without refreshing page?

Answer: We can change the contain of a drop down using AJAX without refresh the page. we can call a AJAX function on the onchange event of drop down. Source:
Question: If you have to work with dates in the following format: "Tuesday, February 14, 2006 @ 10:39 am", how can you convert them to another format, that is easier to use?

Answer: The strtotime function can convert a string to a timestamp.
A timestamp can be converted to date format. So it is best to store the dates as timestamp in the database, and just output them in the format you like.

So let's say we have
$date = "Tuesday, February 14, 2006 @ 10:39 am";
In order to convert that to a timestamp, we need to get rid of the "@" sign, and we can use the remaining string as a parameter for the strtotime function.

So we have
$date = str_replace Source:
Question: What does the header() function in PHP does?

Answer: The header() function sends a raw HTTP header to a client browser. Remember that this function must be called before sending the actual out put.For example, You do not print any HTML element before using this function. Source:
Question: How can I maintain the count of how many persons have hit my site?

Answer: Remove that html comment and execute it

Question: How To Write the FORM Tag Correctly for Uploading Files?

Answer: When users clicks the submit button, files specified in the <INPUT TYPE=FILE...> will be transferred from the browser to the Web server. This transferring (uploading) process is controlled by a properly written <FORM...> tag as:
<FORM ACTION=receiving.php METHOD=post ENCTYPE=multipart/form-data>
Note that you must specify METHOD as "post" and ENCTYPE as "multipart/form-data" in order for the uploading process to work. The following PHP code, called logo_upload.php, show Source:
Question: How to prevent form hijacking in PHP?

Answer: Following things can be done for preventing your PHP Form from Hijacking

1. Make register_globals to off to prevent Form Injection with malicious data.
2. Make Error_reporting to E_ALL so that all variables will be intialized before using them.
3. Make practice of using htmlentities(), strip_tags(), utf8_decode() and addslashes() for filtering malicious data in php
4. Make practice of using mysql_escape_string() in mysql. Source:
Question: What is the use of header() function in php?

Answer: The header() function sends a raw HTTP header to a client.We can use herder() function for redirection of pages. It is important to notice that header() must be called before any actual output is seen. Source:
Question: How to execute an SQL query in PHP? How to fetch its result?

Answer: $my_qry = mysql_query("SELECT * FROM `users` WHERE `u_id`='1'; ");
$result = mysql_fetch_array($my_qry);
echo $result['First_name']; Source:
Question: How can I execute a PHP script using command line?

Answer: 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. Source:
Question: Explain about PHP cookies?

Answer: A Cookie is placed on the user desktop which uniquely identifies the user and every time a user views the webpage the same cookie is retrieved. With PHP a programmer can create and retrieve information simultaneously. The setcookie() function is used to create a cookie and PHP $_COOKIE variable helps the programmer to retrieve the cookie stored on the users computer. These both functions can function simultaneously. Source:
Question: What does the URI used as an XML namespace name point to?

Answer: The URI used as an XML namespace name is simply an identifier. It is not guaranteed to point to anything and, in general, it is a bad idea to assume that it does. This point causes a lot of confusion, so we'll repeat it here:
While this might be confusing when URLs are used as namespace names, it is obvious when other types of URIs are used as namespace names. For example, the following Source:
Question: Explain about Functions in PHP?

Answer: PHP has a large pool of functions and a huge number of them can be created by extensions. These functions can be defined at runtime by defining them inside the code. These functions have to be defined inside the parenthesis except for a class constructor function where there is no argument. Functions can be called or referenced by specifying their name. Source:
Question: What is PEAR in case of PHP?

Answer: PEAR is a framework and distribution system for reusable PHP components.The project seeks to provide a structured library of code, maintain a system for distributing code and for managing code packages, and promote a standard coding style.PEAR is broken into three classes: PEAR Core Components, PEAR Packages, and PECL Packages. The Core Components include the base classes of PEAR and PEAR_Error, along with database, HTTP, logging, and e-mailing functions. The PEAR Packages include functionality Source:
Question: Which will execute faster on php POST or GET? Explain

Answer: Both are same while performing the action but using POST security is there.
Because using GET method in the action, form field values send along with URL, so at the time of sending password, problem will occur means password also will shown in the URL.
Using of POST there is no problem.
Question: How do you create subdomains using PHP?

Answer: Create the appropriate web root directory for example /home/sites/username/web and any subdirectories you wish
1. Edit httpd.conf - add a new virtual host section
2. Restart httpd Source:
Question: What is the importance of "action" attribute in a html form?

Answer: The action attribute determines where to send the form-data in the form submission. Source:
Question: In case of download in php, How will you make a percentage bar showing current status of total 100%?

Answer: Use Following Tips for showing Processing Percentage Bar

1. Use Image for displaying Percentage Bar.

2. Change width of Image depending on Processing completed. Source:

1 2 3 4 5 6 7 Next

India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.03125 Seconds