PHP: Interview Questions PART-8
What does $_SERVER mean?
$_SERVER is an array including information created by the web server such as paths, headers, and script locations.
What does $_FILES means?
$_FILES is an associative array composed of items sent to the current script via the HTTP POST method.
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.
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.
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.
What does $_ENV mean?
$_ENV is an associative array of variables sent to the current PHP script via the environment method.
What does $_COOKIE mean?
$_COOKIE is an associative array of variables sent to the current PHP script using the HTTP Cookies.
What does the scope of variables mean?
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.
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.
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.