PHP Interview Questions and Answers

Q1. What is PHP?

Ans. PHP stands for Hypertext Preprocessor. It is widely used to open source scripting language
. These scripts are executed on the server. You can free to download and use.

Q2. Father Of PHP?

Ans. Rasmus Lerdorf

Q3. What is the difference between == and === operator in PHP?

Ans. Both of the many comparisons used by the PHP are ‘=='(equal operator) and ‘===’
(identical operator). There are differences between the two is that ‘==’ it should be used to check
if the values of the two operands are equal or not. on the other hand, ‘===’checks
the values as well as the type of the operands.

Q4. What are PHP Magic Methods/Functions?

Ans. PHP offers a number of ‘magic’ methods that allow you to do some pretty neat tricks in
object-oriented programming. These methods, identified by a two underscore
prefix (_), functions as interceptors that are automatically called when certain condition met
There are following php magic function in below list As:
1) toString()
2) __toString ( void )
3) __toString()
4) __invoke()
5) __invoke
6) __set_state() static object
7) __set_state ( array $properties )
8) __debugInfo() array
9) __debugInfo ( void )
10) __Sleep
11) __Wakeup

Q5. What is difference between include(),require(),include_once and require_once()?
Ans. There are following differences between As:
1) Include ()- It will only produce a warning (E_Warning) and the script will continue.
2) Required ()- It will produce a fatal error (e_compiler_error) and stop the script.
3) include_once()- It will not be included again. It returns True.
4) require_once()- It is identical to required except PHP will check if the file is already included
so that it is not included again.

Q6. How to increase the execution time of a PHP script?

Ans. ini_set(‘max_execution_time’, 1110);

Q7. What does $_FILES means?

Ans. This is a ‘superglobal’, or automatic global, variable and this is used when you upload a file throughout the form and then you can request $_FILES variable for getting all requested file array.

Q8. What does $_SERVER mean?

Ans. The $_SERVER is a PHP super global variable which holds information about headers, paths, and script locations.

Q9.What does PEAR stand for?

Ans. The PEAR – PHP Extension and Application Repository. PEAR is a framework and distribution system for reusable PHP components.

Q10. What does $_ENV mean?

Ans. The PHP environment variables allow your scripts to glean certain types of data dynamically from the server. This supports script flexibility in a potentially changing server environment.

Q11. What does $_COOKIE mean?

Ans. A cookie is a data history of browser that is stores on client computer and its maximum size of 4KB. Once a cookie has been set, all page requests that follow return the cookie and value.

Q12. Difference between ereg_replace() and eregi_replace()?

Ans.

Q13. What are different types of errors available in Php?

Ans.

Q14. What is difference between strstr() and stristr() ?

Ans.

Q15. What is the difference between unset and unlink?

Ans.

Q16. What is the difference between echo and print?

Ans.

Q17. differences between GET and POST method

Ans.

Q18. 301 redirects in PHP?

Ans.

Q19. Differences between Construstor and Deconstrustor?

Ans.

Q20. Is multiple inheritances supported in PHP?

Ans.

Q21. What is the meaning of a final class and a final method?

Ans.

Q22. What’s the difference between __sleep and __wakeup?

Ans.

News Reporter
IT Software and web development, Core PHP, JavaScript, JQuery, HTML, CSS, CakePHP, Angularjs, Codeigniter etc.

Leave a Reply

Your email address will not be published. Required fields are marked *

error: