PHP Interview Questions
1 .
How to redirect a page in php?
The following code can be used for it, header("Location:index.php");
2 .
How send email using php?
To send email using PHP, you use the mail() function. This mail() function accepts 5 parameters as follows (the last 2 are optional). 

<?php 
    mail($to,$subject,$message,$headers); 
?>

mcrypt_encrypt : string mcrypt_encrypt ( string $cipher , string $key , string $data , string $mode [, string $iv ] ); 
Encrypts plaintext with given parameters

finally you can't send email from localhost. 
3 .
What is function overriding ?
Function definitions in child classes override definitions with the same name in parent classes. In a child class, we can modify the definition of a function inherited from parent class.
4 .
How will you create objects in PHP?
Once you defined your class, then you can create as many objects as you like of that class type. Following is an example of how to create object using new operator.

$clanguage= new Book;
$java = new Book;
$php = new Book;
5 .
What is PHP Date() Function ?
The PHP date() function formats a timestamp to a more readable date and time.

Syntax :
<?php
   date(format,[timestamp]);
?>
6 .
What is a PHP Session ?
PHP session supports in consists of a way to preserve certain data across subsequent accesses.

A visitor accessing your web site or web application is assigned a unique id,  session id. This is either stored in a cookie on the user side or is propagated in the URL.

A PHP session is easily started by making a call to the session_start() function. This function first checks if a session is already started and if none is started  then it starts one. It is recommended to put the call to session_start() at the beginning of the page.
7 .
How Setting Cookies with PHP ?
PHP provided setcookie() function to set a cookie. This function requires upto six arguments and should be called before <html> tag.
Syntax :
setcookie(name, value, expire, path, domain, security);
8 .
What is PHP Error Handling ?
These are functions dealing with error handling and logging. They allow you to define your own error handling rules, as well as modify the way the errors can be logged.   An error message with filename, line number and a message describing the error is sent to the web browser.

This tutorial contains some of the most common error checking methods in PHP.

We will show different error handling methods :

die() statements
Custom errors
Error reporting.
9 .
What are the encryption techniques in PHP ?
MD5 PHP implements the MD5 hash algorithm using the md5 function,
<?php 
$encrypted_text = md5 ($msg); 
?>
10 .
What is PHP mail() Function ?
The PHP mail() function is used to sending emails in user or client.  Email messages is very common for  web applications  (or) web sites, for example : sending a welcome email when a user create a new account on your website,  newsletters, registration purpose,  feedback or comments and contact from etc. 
Syntax :
mail($to, $subject, $message, $headers, $parameters);