- 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: 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: 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: What is the difference between Split and Explode

Answer: split() can work using regular expressions while explode() cannot. Source:
Question: What is the use of obj_start()?

Answer: Its intializing the object buffer, so that the whole page will be first parsed (instead of parsing in parts and thrown to browser gradually) and stored in output buffer so that after complete page is executed, it is thrown to the browser once at a time. Source:
Question: What is difference between mysql_fetch_array(),mysql_fetch_row() and mysql_fetch_object()
please insert with example.

Answer: mysql_fetch_array():: fetches a result row as a associated array, numeric array

mysql_fetch_object: Fetaches a result row as object.

mysql_fetch_row::fetches a result row as array
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: 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: How can I maintain the count of how many persons have hit my site?

Answer: First of all we have to make one text file to store the no of value the user hit..At th first time the file count vatriable is 0 then every time when the form is load and user click on that form at that time we open the file and increment the counter variable one ,,,, then close the file in this way we can find that how many time the the page is hitted by the user

Question: Difference between mysql_connect and mysql_pconnect in PHP?

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. mysql_connect()provides only for the database new connection while using mysql_pconnect, the function would first try to find a (persistent) link that's already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new 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: 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: I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what?s the problem?

Answer: PHP Interpreter treats numbers beginning with 0 as octal. Look at the similar PHP interview questions for more numeric problems. 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: What is htaccess?

Answer: Using this ".htaccess" file we can control "php.ini" and "httpd.conf" file.

For php.ini:

for register globals Enter "php_flag register_globals on" in that file and place it inside the context folder where you are running the php files. Now this is set to globals throughout the files present inside that context folder. This is boolean so we are giving like "php_flag". if it is the value we have to give like "php_value"

For example : [php_value sendmail_from "dineshsdk85@gmail Source:
Question: What is the difference between echo and print statement?

Answer: Difference1:

echo() can take multiple expressions,Print cannot take multiple expressions.

echo has the slight performance advantage because it doesn't have a return value.

True, echo is a little bit faster.
Question: What is the difference between $message and $$message?

Answer: $message is a simple variable whereas $$message is a reference variable. Example:
$user = 'bob'

is equivalent to

$holder = 'user';
$$holder = 'bob'; 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: What is the importance of "method" attribute in a html form?

Answer: "method" attribute determines how to send the form-data into the server.There are two methods, get and post. The default method is get.This sends the form information by appending it on the URL.Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send. 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.078125 Seconds