Saturday, March 14, 2009

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 are the differences between require and include, include_once?

All three are used to an include file into the current page.
If the file is not present, require(), calls a fatal error, while in include() does not.
The include_once() statement includes and evaluates the specified file during the execution of the script. This is a behavior similar to the include() statement, with the only difference being that if the code from a file has already been included, it will not be included again. It des not call a fatal error if file not exists. require_once() does the same as include_once(), but it calls a fatal error if file not exists.

What is the difference between $message and $$message?

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

is equivalent to

$holder = 'user';
$$holder = 'bob';

Friday, March 13, 2009

PHP Interview Questions With Answers

Click at title of post to see the number of php interview questions.

Difference b/w echo and print?

There are following difference:

1. echo is a statement and print is a function.
2. echo can take multiple argument whereas print do not.
3. echo is faster then print function.

What is PHP?

PHP stands for PHP Hypertext Preprocessor. PHP is a scripting language embedded in HTML. for example:
<?php $name = "ashwani kumar"; ?>
<table>
<tr>
<td><?php echo $name; ?></td>
</tr>
</table>
PHP start with <?php tag and end with ?> tag.