PHP Interview Questions and Answers Set 8

71. What does $_SERVER means?

$_SERVER is an array including information created by the web server such as paths, headers, and script locations.

72. What does $_FILES means?

$_FILES is an associative array composed of items sent to the current script via the HTTP POST method.

73. What is the difference between $_FILES[‘userfile’][‘name’] and $_FILES[‘userfile’][‘tmp_name’]?

$_FILES[‘userfile’][‘name’] represents the original name of the file on the client machine,

$_FILES[‘userfile’][‘tmp_name’] represents the temporary filename of the file stored on the server.

74. How can we get the error when there is a problem to upload a file?

$_FILES[‘userfile’][‘error’] contains the error code associated with the uploaded file.

75. How can we change the maximum size of the files to be uploaded?

We can change the maximum size of files to be uploaded by changing upload_max_filesize in php.ini.

76. What does $_ENV means?

$_ENV is an associative array of variables sent to the current PHP script via the environment method.

77. What does $_COOKIE means?

$_COOKIE is an associative array of variables sent to the current PHP script using the HTTP Cookies.

78. What does the scope of variables means?

The scope of a variable is the context within which it is defined. For the most part all PHP variables only have a single scope. This single scope spans included and required files as well.

79. what the difference between the ‘BITWISE AND’ operator and the ‘LOGICAL AND’ operator?

$a and $b:    TRUE if both $a and $b are TRUE.

$a & $b:        Bits that are set in both $a and $b are set.

80. What are the two main string operators?

The first is the concatenation operator (‘.’), which returns the concatenation of its right and left arguments. The second is (‘.=’), which appends the argument on the right to the argument on the left.