CoolInterview.com - 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
COOLINTERVIEW.COM PROGRAMMING LANGUAGES INTERVIEW QUESTIONS PHP INTERVIEW QUESTIONS 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: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
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
Source: CoolInterview.com
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: CoolInterview.com
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 ....by one ,,,, then close the file in this way we can find that how many time the the page is hitted by the user

Source: CoolInterview.com
Question: What is the difference between Split and Explode

Answer: split() can work using regular expressions while explode() cannot. Source: CoolInterview.com
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: CoolInterview.com
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.
Source: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
Question: What are the different tables present in MySQL? Which type of table is generated when we are creating a table in the following syntax: create table employee(eno int(2),ename varchar(10))?

Answer: Total 5 types of tables we can create
1. MyISAM
2. Heap
3. Merge
4. INNO DB
5. ISAM
MyISAM is the default storage engine as of MySQL 3.23. When you fire the above create query MySQL will create a MyISAM table. Source: CoolInterview.com
Question: What are new features that are in added in PHP5?

Answer: Following are new features added in PHP5

1. PHP 5 introduces the Standard PHP Library (SPL), which provides a number of ready-made classes and interfaces.
2. Access Modifiers are added in PHP5
3. PHP5 has built-in exception classes that makes it very easy to create your own customized exceptions through inheritance.
4. PHP 5 introduces the mysqli (MySQL Improved) extension with support for the features of MySQL databases versions 4.1 and higher. So use of prepare statements are a Source: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
Question: What does the function get_magic_quotes_gpc() means?

Answer: The function get_magic_quotes_gpc() tells us whether the magic quotes is switched on or no. Source: CoolInterview.com
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: CoolInterview.com

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.015625 Seconds