Friday, January 31, 2020

php Interview Questions

Image result for php logo
QuestionExplain the difference between GET and POST requests.
Answer: Any PHP developer needs to have an adequate understanding of the HTTP protocol. The differences between GET and POST are an indispensable part of the HTTP protocol learning. Here are the major differences between the two requests:
  • GET allows displaying the submitted data as part of the URL. This is not the case when using POST as during this time the data is encoded in the request.
  • The maximum number of characters handled by GET is limited to 2048. No such restrictions are imposed on POST.
  • GET provides support for only ASCII data. POST, on the other hand, allows ASCII, binary data, as well as other forms of data.
  • Typically, GET is used for retrieving data while POST is used for inserting and updating data.
QuestionExplain the mail function and its syntax.
Answer: In order to directly send emails from a script or website, the mail() function is used in PHP. It has a total of 5 arguments. The general syntax of a mail function is:
mail (to, subject, message, headers, parameters);
  • to denotes the receiver of the email
  • subject denotes the subject of the email
  • message is the actual message that is to be sent in the mail (Each line is separated using /n and maximum character limit is 70.)
  • headers denote additional information about the mail, such as CC and BCC (Optional)
  • parameters denote to some additional parameter to be included in the send mail program (Optional)

No comments:

Post a Comment

Which Python course is best for beginners?

Level Up Your Python Prowess: Newbie Ninjas: Don't fret, little grasshoppers! Courses like "Learn Python 3" on Codecade...