Q1. Who is the father of PHP and explain the changes in PHP versions?Ans: Rasmus Lerdorf in 1994Q2. How many ways you can retrieve the date in the result set of mysql using PHP?Ans: We can do it by 4 Ways 1. mysql_fetch_row. ,
2. mysql_fetch_array ,
3. mysql_fetch_object 4. mysql_fetch_assoc
Q3. How can we create a database using php and mysql?
Ans: <?php
$query =mysql_query( "CREATE DATABASE phpcake");
?>Q4. What is the difference between mysql_fetch_object and mysql_fetch_array?
Ans: 1. object is returned, instead of an array
2. In this you can only access the data by the field names
Q5. What are the differences between Get and post methods.
Ans: GET Method have some limit like only 2Kb data able to send for request But in POST method unlimited data can we send.
Q6. What are the differences between require and include?
Ans: Include and require used to include a file but If included file not found Include send Warning where as Require send Fatal Error .Q7. What is the difference between the functions unlink and unset?Ans: unlink() deletes the given file from the file system.unset() makes a variable undefined.Q8. What are the different functions in sorting an array? Ans: Sort(), arsort(),asort(), ksort(),natsort(), natcasesort(),rsort(), usort(),array_multisort(), and uksort().
Q9. How can we know the count/number of elements of an array?
Ans: a) sizeof($urarray) This function is an alias of count() count($urarray)Q10. How can we find the number of rows in a table using MySQL?
Ans: SELECT COUNT(*) FROM table_name;
Q11. How can we know the number of days between two given dates using PHP?
Ans: $date1 = date("Y-m-d"); $date2 = "2006-08-15"; $days = (strtotime($date1) - strtotime($date2)) / (60 * 60 * 24);
Q12. what are magic methods?Ans: Magic methods are the members functions that is available to all the instance of class Magic methods always starts with "__". Eg. __construct All magic methods needs to be declared as public To use magic method they should be defined within the class or program scope Various Magic Methods used in PHP 5 are: __construct() __destruct() __set() __get() __call() __toString() __sleep() __wakeup() __isset() __unset() __autoload() __clone()
Q13. Email function in PHP?
Ans: <?php $to = qualityzoneinfotech@gmail.com;
$subject = 'Qualityzoneinfotech.';
$body = "<p><strong>Heading...</strong> <br />
<strong>Custmer Name:</strong> <?php $name ;?> </p><br />
<strong>Custmer Email:</strong> <?php $email; ?>l </p><br />
<strong>Order Date:</strong> <?php date; ?>";
$headers = 'MIME-Version: 1.0' . "rn";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
$headers .= 'From: qualityzoneinfotech.com <qualityzoneinfotech@gmail.com>' . "rn";
$headers .= 'Cc: qualityzoneinfotech@gmail.com' . "rn";
mail($to, $subject, $body, $headers);
?>