PHP Interview Questions Part I

I hope this would be helpful for the jobseekers.

This is "three part" article


1. 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 ?

Ans:
Get- sends requset in the form of qusery string and post hides the
data, and send directly to system.out


2. Who is the father of php and explain the php versions

Ans: Rasmus Lerdorf

3. How can we submit a form without a submit button

Ans:
1. image button 2. button. 3. java script form.submit() function

4. How many ways we can retrieve the date in result set of mysql using php

Ans:
4 ways, 1. mysql_fetch_row. 2. mysql_fetch_array. 3.
mysql_fetch_object 4. mysql_fetch_assoc


5. What is the difference between mysql_fetch_object and mysql_fetch_array

Ans:
mysql_fetch_object -- Fetch a result row as an object
mysql_fetch_array -- Fetch a result row as an associative array, a
numeric array, or both.


6. What is the difference between $message and $$message

Ans:
$message- is a varibale. $$message is a variable inside varibale


7. How can we extract string 'abc.com ' from a string 'http://info@abc.com' using regular expression of php

Ans:

$line="http://info@abc.com";
if (eregi ("http://(.*)@(.*)", $line, $add))
echo $add[2];


8. How can we create a database using mysql

Ans:
mysql_create_db in php. Create database name....

9. What is the differences between require and include, include_once

Ans:
include: warning require : fatal-error
include_once should be used in cases where the same file might be
included and evaluated more than once during a particular execution of a
script.


10. can we use include("myfile.php") two times in a php age "makeit.php"

Ans:
yes we can include twice.

11. 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))

Ans:
MYISAM, ISAM, MERGE, HEAP, INNODB, BERKLEYDB. The Default Type is
"MYISAM"

12. Functions in IMAP, POP3 AND LDAP

Ans:
Please check in the manual (some people say RTFM... no offence !)


15. Shopping cart online validation ie how can we configure the Nobel Pay

Ans:
It is done thru curlfunction card details will be sent to the page in Nobel pay site which is already given to us by them. Only we have to send the parameters which is required for calling that page.

1 comments:

mindlan said...

Who is the father of php and explain the changes in php versions?

Rasmus Lerdorf for version changes go to http://php.net/ 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 mysql_fetch_object and mysql_fetch_array?

MySQL fetch object will collect first single matching record where mysql_fetch_array will collect all matching records from the table in an array.

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.

Post a Comment