1) PHP supports the following basic data types as seen below:
An integer (integer), float (floating-point), String (String), Boolean (Boolean), Array (array), object, and two special types: null (empty), resource (Resource).
Note: A variable that is not assigned, has been reset, or is assigned a special value of NULL is a variable of type null.
A specific built-in function, such as a database function, returns a variable of type resource.
2) Scopes are scopes that can be used or visible by a variable in a script. PHP has 6 main scope rules:
2.1) built-in super global variables can be used and visible anywhere in the script;
2.2) constant. Once it is declared. will be able to be globally visible.
2.3) The global variables declared in a script are visible throughout the script;
2.4) When a variable used inside a function is declared as a global variable, its name is the same as the global variable name;
2.5) A variable that is created inside a function and declared as static cannot be visible outside the function, but is able to persist the value during multiple runs of the function.
2.6) variables created inside the function are local to the function. When the function terminates, the variable does not exist.
Note: The complete list of super global variables, as seen below:
$GLOBALS--An array of all global variables.
An array of $_server--server environment variables.
$_get--the array of variables passed to the script by the GET method;
$_post--the array of variables passed to the script via the POST method;
An array of $_cookie--cookie variables.
$_files--array of variables related to file uploads;
An array of $_env--environment variables;
$_request--An array of variables entered by all users. Includes input from $_get, $_post, and $_cookie.
An array of $_session--session variables.
PHP Data types and scope of variables