Monday, February 19, 2018

phpMyPassion

Basic PHP Interview Questions and Answers for Freshers

Here I am sharing top most asked basic PHP interview questions and answers for freshers that will helpful for freshers to get a job. All questions are related to PHP programming language so do prepare before the interview.

Question #1 - What is PHP?

PHP is an open source server side scripting language mostly used for web applications. Its easy to learn compare to other programming language. PHP also a object oriented programming language like java, .net and c++.

Question #2 - Who is the father of PHP and when it is developed?

PHP was developed in year 1994 by Rasmus Lerdorf.

Question #3 - What is the use of "echo" in php?

Mainly "echo" used to print a data on screen, for an Example: <?php echo 'This is my first website'; ?> , if we run it on browser, it will print the text on the screen.
Question #4 - How to include a file to a php page?

We include a file using "include('filepath.php') " or "require('filepath.php')" function with file path as its parameter.

Question #5 - What is the difference between PHP4 and PHP5?

Below are the difference :-

Sr. No.
PHP4
PHP5
1.
PHP4 doesn’t support oops concepts
PHP5 supports oops concept
2.
Error handling is not good
Error handling is better
3.
PHP4 doesn’t show the function parameter hint.
PHP5 supports function’s perameter
Question #6 - What's the difference between include and require?

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

Question #7 - Differences between GET and POST methods ?

We can only send 1024 bytes through GET method but by POST method can transfer large amount of data and POST is also a secure method than GET method .

Question #8 - What is the use of 'print' in php?

Print commonly used to print text on screen like echo but print has a return type.  you can use with out parentheses with its argument list.
Example 
print('50 PHP Interview questions'); 
print 'Job Interview questions ');

Question #9 - What is the difference between echo and print

Below are the difference between echo and print :-

  • Print has a return type value while Echo doesn't return any value.
  • Echo is faster then Print.
  • In Echo you can pass multiple argument while single argument can be pass in Print.

Question #10 - what is the use of isset() in php?

isset() function is used to ensure if a variable is set and is not NULL

Question #11 - What is the difference between $var and $$var?

Both are and just like a variable only difference is $var is only a variable while $$var is variable in a another variable. for an example -
$var = 'love';  //only a variable
$$var = 'PhpMyPassion.com';  // a variable that contain another vairable

means ${$var} where $var is equals to 'love'; so we can say $love is equals to $$var

Question #12 - What is the maximum  filesize that can be uploaded in PHP and how can we increase it?

The maximum size of a file that can be uploaded is set 2MB By default. if you want to change, you can do that by changing the maximum uploaded size value inside php.ini file set by upload_max_filesize = 5M and restart all the services.

Question #13 - How can we get the value of current session id?

You can get the current session id by using session_id() function in PHP.

Question #14: How to identify server IP address in PHP?

you can identify server IP address by using $_SERVER['SERVER_ADDR']; 




About Author -

Hi, I am Anil.

Welcome to my eponymous blog! I am passionate about web programming. Here you will find a huge information on web development, web design, PHP, Python, Digital Marketing and Latest technology.

Subscribe to this Blog via Email :

Note: Only a member of this blog may post a comment.