1. Described PHP?

The PHP Hypertext Preprocessor is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is basically used for developing web based software applications.

2. Described session in PHP?

A session is a logical object created by the PHP engine to allow you to preserve data across subsequent HTTP requests.

There is only one session object available to your PHP scripts at any time. Data saved to the session by a script can be retrieved by the same script or another script when requested from the same visitor.

Sessions are commonly used to store temporary data to allow multiple PHP pages to offer a complete functional transaction for the same visitor.

3. What is PEAR in PHP?

PEAR is the next revolution in PHP. This repository is bringing higher level programming to PHP. PEAR is a framework and distribution system for reusable PHP components. It eases installation by bringing an automated wizard, and packing the strength and experience of PHP users into a nicely organised OOP library. PEAR also provides a command-line interface that can be used to automatically install "packages"

4. Can you please explain 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.

$message is a simple variable whereas $$message is a reference variable. Example:
$user = 'bob'
is equivalent to
$holder = 'user';
$$holder = 'bob';

5. How you can protect special characters in Query String?

If you want to include special characters like spaces in the query string, you need to protect them by applying the urlencode() translation function. The script below shows how to use urlencode():

<?php
print("<html>");
print("<p>Please click the links below"
." to submit comments about GlobalGuideLine.com:</p>");
$comment = 'I want to say: "It's a good site! :->"';
$comment = urlencode($comment);
print("<p>"
."<a href="processing_forms.php?name=Guest&comment=$comment">"
."It's an excellent site!</a></p>");
$comment = 'This visitor said: "It's an average site! :-("';
$comment = urlencode($comment);
print("<p>"
.'<a href="processing_forms.php?'.$comment.'">'
."It's an average site.</a></p>");
print("</html>");
?>

7. List the purpose of the following files having extensions: frm, myd, and myi? What these files contain?

In MySQL, the default table type is MyISAM.
Each MyISAM table is stored on disk in three files. The files have names that begin with the table name and have an extension to indicate the file type.

The '.frm' file stores the table definition.
The data file has a '.MYD' (MYData) extension.
The index file has a '.MYI' (MYIndex) extension,

8. How to find out the number of parameters passed into function9.?

func_num_args() function returns the number of parameters passed in.

9. Can you please explain the difference between ereg_replace() and eregi_replace()?

eregi_replace() function is identical to ereg_replace() except that it ignores case distinction when matching alphabetic characters.

10. Described the functionality of the function strstr and stristr?

strstr() returns part of a given string from the first occurrence of a given substring to the end of the string. For example: strstr("user@example.com","@") will return "@example.com".
stristr() is idential to strstr() except that it is case insensitive.

Download Interview PDF