> November 2013 ~ Online tutorial

75% discount Hosting plan sale in Hostgator

75% discount Hosting plan sale in Hostgator

HostGator is one of the world's top 10 largest web hosting companies and offers the Black friday offer today.
Offer In Hostgator

Hostgator is offering 1 hour flash sale on Black friday, and you can grab hosting for as low as $1.24/month.
Discount: Various discount from Black friday to Cyber monday.
Start date: Today
End date: December 2nd

Click To Get

PHP interview Question with answer

PHP interview Question with answer

print $varB;


It is result is Two because $varB holds the reference of $varA value an dboth $varA and $varB poin the same value.

echo "Greatest of no".$val;num2;

It is greatest of two number in the given number.

3)what is print_r()?

The print_r() is used to print out the entire content of array.

4)What happened below code
print "type(152).gettype(152)."\n";


it is return the 152 as an Integer value.gettype() is used to get the datatype.

5)How do find the Ip address of remote machine?


echo "your ip address is ".$SERVER['REMOTE_ADDR'];

echo ucfirst("helloworld");
what happened in this code?


It is return the output Hello world.the ucfirst() is used to convert the first character in to Uppercase.

7)Difference between include() and require()?

In include() function if can't include the file it is generate error but continue the execution of program but require() function if can't include the file it is generate fatal error in script.

8)How destroy the session in PHP?

In session we are using unset() or session_destroy() function which is used to destroy the session in PHP.

9)What is use of explode() in PHP?
explode() function is used to convert string into array.

10)How do connect PHP with Mysql query?


How do Upload File using PHP

How do Upload File using PHP

In PHP we are using two file which used upload file in the server.First one Html file and another one is PHP file .

In the Html file we are going get file content and PHP file we are process it and Upload into Particular file path.


In the coding section we are show First html file.In the html file we are going to get file and sent to php file using POST method.Here code for HTML file.


1)In the form enctype/form data encding when submitting to the server.

<form enctype="multipart/formdata" action="saveupload.php" method="post">
<input type="file" name="fileToUpload">
<input type="submit" value="UploadFile">


1)$_FILES["file"]["name"] it is used get the name of file
2)$_FILES["file"]["type"] it is used to get type of file  
3)$_FILES["file"]["size"]  it is used to get size of file 
4)$_FILES["file"]["tmp_name"]  it is give tmp name of file which is ued to store the file in folder.


echo "<table border=\"1\">";
echo "<tr><td>Client Filename: </td>

   <td>" . $_FILES["file"]["name"] . "</td></tr>";

echo "<tr><td>File Type: </td>
   <td>" . $_FILES["file"]["type"] . "</td></tr>";
echo "<tr><td>File Size: </td>
   <td>" . ($_FILES["file"]["size"] / 1024) . " Kb</td></tr>";
echo "<tr><td>Name of Temp File: </td>
   <td>" . $_FILES["file"]["tmp_name"] . "</td></tr>";
echo "</table>";

move_uploaded_file($_FILES["file"]["tmp_name"], "C:/upload/" . $_FILES["file"]["name"]);



Here Upload is folder we can create in you local computer it is save the file.