PHP Interview Questions – Part 1

1) What is the use of header() function in php ?

Answer :- The header() function sends a raw HTTP header to a client browser.Remember that this function must be called before sending the actual out put.For example, You do not print any HTML element before using this function.
2) How to redirect a page in php?

Answer :- The following code can be used for it, header(“Location:index.php”);
3) How stop the execution of a php scrip ?

Answer :- exit() function is used to stop the execution of a page
4) How to set a page as a home page in a php based site ?

Answer :- index.php is the default name of the home page in php based sites
5) How to find the length of a string?

Answer :- strlen() function used to find the length of a string

Skip to toolbar