1) PHP supports basic data types as shown 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) scope refers to a range of variables that can be used or visible in a script. PHP has 6 basic scope rules:
2.1) built-in super global variables can be used and visible anywhere in the script;
2.2) constants, once declared, will be visible globally;
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 can be persisted during multiple executions of the function;
2.6) variables created inside the function are local to the function, and when the function terminates, the variable does not exist.
Note: The complete list of super global variables is as follows:
$GLOBALS?? Array of all global variables;
$_server?? Array of server environment variables;
$_get?? An array of variables passed to the script by the Get method;
$_post?? An array of variables passed to the script through the Post method;
$_cookie?? array of cookie variables;
$_files?? An array of variables related to file uploads;
$_env?? An array of environment variables;
$_request?? An array of variables entered by all users, including the inputs contained in $_get, $_post, and $_cookie;
$_session?? An array of Session variables.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.