PHP interview questions and answers for freshers ?

PHP interview questions and answers for freshers ?

PHP interview questions and answers for freshers?

PHP interview questions and answers for freshers? :- To clear PHP Technical interview round, A candidate should be prepared for what type of question can be asked by the interviewer, We have provided a list of questions which are commonly asked by Companies.

PHP interview questions can help you to test knowledge of your programming skills in PHP, Answers to PHP Questions are also explained step by stepwise.

1 > What is PHP?

Php stands for hypertext preprocessor.It is a Server Side Scripting Language used to make websites and Web Applications.Php is also an Object Programming Language.Various types of CMS are built by using PHP like WordPress, Drupal, and Joomla. Zend Framework and Codeigniter Framework are used to built Web Application using MVC (Model Controller View ) architecture.

2>How to include a file in PHP Programming?

To include a file in  “include() ” or “require()” or include_once ?> function with right file name as a parameter .

Ex :- <?php  include(images/abc.jpg)  ?>

3> What’s the difference between include and require?

When you declare require() function in PHP, it will cause a fatal error and stop the execution of the PHP script. In Second Case, if the file is not found by include(), a warning will be issued, but execution will continue.

4>How to Declare Function in PHP?

To declare a function in php you  should follow following php syntax.Php function name always declared with parenthesis;

Ex :- <?php

InterviewAnswersPhp()

{

echo ‘ PHP interview questions and answers for freshers‘;

}

?>

5>Which function of PHP is used to check the length of string ?

To check the length of the string, We can use strlen() function by passing a string variable as a parameter.

Ex :- <?php

$str_length=”Php”;

echo strlen($str_length); 

?>

6: How to declare a variable in  PHP language ?

In php langauge, $ is used to declare a variable in PHP language.

Ex :- <?php

$declare_var=”Php”;

echo strlen($str_length); 

?>

7. How can we send data from HTML Form to Server ?

By using METHOD Attribute of HTML .It determines how to send form data into server by  using two method GET and POST.HTML Form takes default GET Method if we don’t specify

Ex:- <html>

<head> </head>

<form name=”php-interview” method=”POST”>

<input type =”text” />

<input type=”submit”>

</form>

</html>

8 >Why we use of isset()  function in php ?

isset() is used to check variable has a value means it is set and is not NULL.

9> If we have to stop the script then which function should we use ?

To stop the script we use exit() function in PHP.

10> How can we set any PHP page as a homepage in Web Application?

To set Any page as a home page then we should name a file as index.php/

Leave a Comment