PHP, MySQL, Javascript, CSS and Ajax Interview Questions and Answer Part – 3

21. What is the difference between html and xhtml? and How do we convert from html to xhtml?

* XHTML elements must be  properly nested
* XHTML elements must always be closed
* XHTML elements must be in lowercase
* XHTML documents must have one root element
* Empty Elements Must Also Be Closed
* Attribute names must be in lower case
* Attribute values must be quoted
* Attribute minimization is forbidden
* The XHTML DTD defines mandatory elements

22. How do you know (status) whether the recipent of your mail had opened the mail i.e read the mail?

In PHP we can use “Disposition-Notification-To:” in header function.

23. What are the ajax states?

0 – request is not initialised
1 – request has been set up
2 – request has been sent
3 – request is in progress
4 – request has been completed

24. What is the difference between setTimeout() and setInterval() in javascript;

setTimeout: Run once and then stop.
setInterval: Run by loop.

25. What is SQL Injection?

The way of inserting sql script into the code without knowledge of developer.

26. How to check the value is Integer in PHP

Below is the function for checking whether value is Integer and returns true if it is integer.

function isInteger($input) {
return (boolean)preg_match(“/[0-9]/”, $input);
its return TRUE.

27. How to remove the duplicate values using PHP array

Below is the code example for removing duplicate values in PHP
$php_array = array(‘Php’,’Mysql’,’Php’, ‘java’);
$i = 0;
while($i < count($php_array)){
if($php_array[$i] == next($php_array))
unset ($php_array[$i]);

28. How to send mail from PHP Localhost Server

Yes, we can send the Email from Local Machine and Internet Connection is must.
Open your php.ini file located in your folder C:\wamp\bin\php\php5.3.4
Search for mail function in the php.ini file. Change localhost to mailer server name of your webhosting account and save it. Finally restart your local wamp server.
[mail function]
; For Win32 only.
smtp_port = 25
; For Win32 only.
sendmail_from =

29. What are they ways available to Pass Values between Pages in PHP?

There are basically four ways to pass values between one PHP Page to Another PHP Page.
1) URL ($_GET)
2) Session ($_SESSION)
3) Via a cookie ($_COOKIE)
4) Form Submitting via POST ($_POST)


$HTTP_POST_VARS is an global array used to pass form values across page. In order to use this global array we need to turn on in php.ini file
register_long_arrays on

Leave a Reply

Your email address will not be published.