php interview questions and answers for 3 year experience
Posts: 14,118
Threads: 61
Joined: Oct 2014
PHP Interview Questions and Answers -
1. What is PHP?
Ans
PHP (Hyper Text Pre Processor) is a scripting language commonly used for web applications. PHP can be easily embedded in HTML. PHP usually runs on a web server. It is available for free and can be used on a wide variety of servers, operating systems and platforms.
2. What are the differences between the GET and POST methods in submitting forms, give the case where we can use get and can we use post methods?
Ans
On the server side, the main difference between GET and POST is where the uploaded file is stored. The $ _GET array stores the data sent by the GET method. The $ _POST array stores the data sent by the POST method.
On the browser side, the difference is that the data sent by the GET method will be displayed in the address field of the browser. Data sent by the POST method will not be displayed anywhere in the browser.
The GET method is mainly used to send a small amount and less sensitive data. The POST method is mainly used to send a large amount or confidential data.
3. Who is the father of php and explain the changes in php versions?
Ans
Rasmus Lerdorf for version changes go to http://php.net/ Marco Tabini is the founder and publisher of php | Architect
4. How can we send a message without sending a button?
Ans
We can use a simple JavaScript code linked to an event trigger from any form field. In the JavaScript code, we can call the document.form.submit () function to submit the form.
5. How many ways can we retrieve the date in the mysql result set Using php?
Ans
As individual objects as single record or as a set or arrays.
6. What is the difference between $ message and $$ message?
Ans
Both are variables. But $ message is a variable with a fixed name. $$ is a variable whose name is stored in $ message. For example, if $ message contains "var", the message $$ is the same as $ var.
7. What are the differences between require and include, include_once?
Ans
The file will not be included more than once. If we want to include a file once and the extra call of the file will be ignored then we have to use the include_once () PHP function. This will avoid problems with function redefinitions, variable value reallocations, etc.
8. What is meant by nl2br ()?
Ans
Nl2br Inserts HTML line breaks before all new lines in a string string nl2br (string); For example: echo nl2br ("God bless you")
It will produce "God bless you" to your browser.
9. What are the current versions of apache, php and mysql?
Ans
PHP: php 5.3
MySQL: MySQL 5.5
Apache: Apache 2.2.
10. What are the reasons for selecting the lamp (Linux, apache, mysql, php) instead of the combination of other software programs, servers and operating systems?
Ans
All of them are open source resources. Linux security is much, much more than windows. Apache is a better server than IIS, both in functionality and security. Mysql is the most popular open source database in the world. PHP is faster than asp or any other scripting language.
11. How can we encrypt and decrypt the data present in a mysql table using mysql?
Ans
AES_ENCRYPT () and AES_DECRYPT ()