PHP Interview questions with answers for Freshers - 1

Many interview questions we already listed on this blog, please read through out the posts related to PHP interview questions.


Q. What is the use of "echo" in php?
Answer: It is used to print a data in the webpage,
Example: <?php echo 'Welcome to Technology Park'; ?>
It will print the output or text on webpage as:
Welcome to Technology Park

Q. How to include a file to a php page?
VERY IMPORTANT INTERVIEW QUESTION
Answer: We can include a file using "include() " or "require()" function with file path as its parameter.

Q. How stop the execution of a php scrip ?
Answer: exit() function is used to stop the execution of a page.
At any point of script you can use the exit or exit() statement.

example:
<?php
echo "Welcome to Technology Park";
exit();
echo "not printed";
?>

Output:
Welcome to Technology Park

Q. How do you define a constant?
Answer:Using define() directive, like define ("MYCONSTANT",150)


Keep visiting the blog regularly for Latest Interview questions and Resume Tips.