Question-61. How will you send an email using PHP ?

Answer- PHP makes use of mail() function to send an email. This function requires three mandatory arguments that specify the recipient’s email address, the subject of the the message and the actual message additionally there are other two optional parameters.

mail( to, subject, message, headers, parameters );

 

Question-62. What is the purpose of $_FILES variable in PHP ?

Answer- This is a global PHP variable. This variable is an associate double dimension array and keeps all the information related to uploaded file.

Question-63. Define $_FILES[‘file’][‘tmp_name’] ?

Answer- It provides access to the uploaded file in the temporary directory on the web server.

Question-64. How will you access the actual name of the uploaded file in PHP ?

Answer- Using $_FILES[‘file’][‘name’] − it provides the actual name of the uploaded file.

Question-65. How will you access the size of the uploaded file in PHP ?

Answer- Using $_FILES[‘file’][‘size’] − it provides the size in bytes of the uploaded file.

Question-66. How will you access the content type of the uploaded file in PHP ?

Answer- Using $_FILES[‘file’][‘type’] − it provides the MIME type of the uploaded file.

Question-67. How will you access the error code associated with file upload in PHP ?

Answer- Using $_FILES[‘file’][‘error’] − it provides the error code associated with this file upload.

Question-68. What is the purpose of $GLOBALS variable in PHP ?

Answer- $GLOBALS − Contains a reference to every variable which is currently available within the global scope of the script. The keys of this array are the names of the global variables.

Question-69. What is the purpose of $_SERVER variable in PHP ?

Answer- $_SERVER − This is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these. See next section for a complete list of all the SERVER variables.

Question-70. What is the purpose of $_COOKIE variable in PHP ?

Answer- $_COOKIE − An associative array of variables passed to the current script via HTTP cookies.