PHP Interview Questions and Answers for Fresher

php interview questions for Fresher

Ques. What is PHP ?

We use server-side scripting language commonly for Web development . PHP is one of them. a server-side scripting language , used for web applications . PHP has many frameworks and CMS for creating websites . By using it’s CMS , even a non-technical person can create sites . Some of the famous CMS of PHP are WordPress , OSCommerce . PHP is also an object-oriented programming language like Java, C-sharp, etc. PHP is easy enough to learn and create websites .

Ques. What is the use of “echo” in PHP ?

Echo in php is used to print a data in the Web Page . Example : <?php echo ‘Car insurance’ ; ?>, The following code print the text “Car Insurance” in the Webpage .

Ques. How to include a file to a PHP page ?

We can include a file in php using “ include() ” or “ require() ” function with file path as its parameter.

Ques. What’s the difference between include and require ?

If the file is not found by require() , it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue .

Ques. What is difference between require_once() , require() , include() ?

require() : It includes and evaluates a specific file , while require_once() does that only if it has not been included before (on the same page) . So, require_once() is recommended to use when you want to include a file where you have a lot of functions for example. This way you make sure you don’t include the file more times and you will not get the “ function re-declared ” error .

Ques. What is differences between GET and POST methods ?

We can send 1024 bytes using the GET method but POST method can transfer a large amount of data and POST is the secure method than the GET method .

Ques. How to declare an array in PHP ?

We declare var $arr = array(‘digitechbits’, ‘digitech’, ‘bits’) ;

Ques. What is the use of ‘print’ in PHP ?

This is not actually a real function, It is a language construct . So you can use without parentheses with its argument list.
Example :  print(‘ PHP Interview questions by Digitechbits ’) ;

Ques. What’s the difference between include and require?

It’s how we handle failures in php . If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include() , a warning will be issued, but execution will continue .

Come back for more Questions

Learn HTML Elements

Leave a Reply

Your email address will not be published.