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:
2) __toString ( void )
6) __set_state() static object
7) __set_state ( array $properties )
8) __debugInfo() array
9) __debugInfo ( void )
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. ereg_replace() function is used to replace regular expression case censitive
– eregi_replace() function is used to replace regular expression case incensitive
Q13. What are different types of errors available in Php?
Ans. In PHP measurely three types of error.
– Notices error
– Warning error
– Fatal error
Q14. What is difference between strstr() and stristr() ?
Ans. strstr() and stristr both are used to find the first occurence of the string.
stristr( ) is case insensitive and strstr( ) is case sensitive
Q15. What is the difference between unset and unlink?
– Unlink function is used for a deleting a file from specific path.
– Unset function is used for a reset a declared variable data.
Q16. What is the difference between echo and print?
– Print is used for printing a data but print function can support one statement for printing and it’s slow comparable to echo.
– Echo is used for printing a data same as a print function but there is difference echo can support multiple statement and it’s fast execution compare then print.
Q17. differences between GET and POST method
Both are form methods and submitting a data to server but differences in that are-
– Get method can send limited data to server around 2kb and it’s submitting data by URL and it’s visible in my url which i have submitted.
– Post method can send large data to server and there is not any limit and it’s secure not visible in my request but it’s slow then Get method.
Q18. 301 redirects in PHP?
Q19. Differences between Construstor and Deconstrustor?
– Constructor and deconstructor both are related to class but main difference in this constructor is executed when class is initialised before executing other functions constructor will execute first.
– Deconstructor function is execute when explicitly destroy an object or all references goes out from current scope.
Q20. Is multiple inheritances supported in PHP?
Ans. Multiple inheritance not supporting in php 5 but now in PHP 7 multiple inheritance support by using Interface or traits.
Q21. What is the meaning of a final class and a final method?
Ans. Final method and final class both are related to Oops-
– Final class can’t be instantiate.
– Final method can’t be override.
Q22. What’s the difference between __sleep and __wakeup?