In-depth explanation of php functions and variable scopes
Function & func (){
Return "";
}
2. add a reference symbol before the function during the call.
$ Return = & func ();
PHP has
BasisA dollar sign in PHP followed by a variable name, which represents a variable. The name of the variable is case-sensitive.The variable name follows the same rules as other tags in PHP. A valid variable name begins with a letter or underscore,
First, variable and expression
PHP variables begin with the dollar sign, with the name as a distinction between variables, the variable name length is such as: $_name= "Zhoulang";//Legal $name = "Zhoulang";//Legal $1name= "Zhoulang"; Non-law
Second,
function function_name () {
Global $var;
}
$var = 20;
Function_name (); Function call.
?>
Copy CodeIn this example, the $var inside the function is now the same as the $var outside the function.
Php Tutorial: array declaration, traversal, array global variables
Copy codeThe Code is as follows: /*
* 1. array Overview
* 1. The essence of Arrays: managing and operating a group of variables, batch processing
* 2. array composite type (multiple
This article mainly introduced the PHP Super Global Array (superglobals) Introduction, this article explained the outline, the variable scope, the Super Global array and the attention matter and so on content, needs the friend to be possible to
A scope is one in which a variable can be used or visible in a script. PHP has 6 fundamental scoping rules.
1. Built-in super global variables can be used and visible anywhere in the script. For example:
Print_r ($_server[' http_host ');//$_server['
PHP BasicsFirst, the initial knowledge of PHPPHP is an embedded language that is used in combination with HTML.1, PHP tagsThe default tag short mark.??, you need to turn on the Short_open_tag option to open short and other tags in php.ini is not
The scope of variables in PHP can be divided into: Super Global (the special type of global variables, in the local scope can be used directly), global, Local, static (is a special type of local variables)In PHP, the global variable is actually a
1. PHP Cookies
A cookie is a mechanism for storing data on a remote browser side to track and identify the user. PHP sends cookies in the header information of the HTTP protocol, so the Setcookie () function must be called before other information
This article is about the difference between hyper-global variables $globals and Global in PHP.
One, super global variable $globalsThere are many PHP hyper-global variables, such as the following are super global variables (superglobal):$GLOBALS, $_
1. PHP COOKIECookie is a mechanism for storing data in a remote browser and tracking and identifying users. PHP sends cookies in the http header. Therefore, the setcookie () function must be called before other information is output to the browser,
PHP is a language designed for website background development. More and more object-oriented content is added after the new version 5.3. I am gradually optimistic about this language, I have recently learned some things and recorded some key points
What is the difference between single and double quotes in PHP?
1. As can be seen, the double-quote variable is parsed and output, and the single-quote variable is not resolved.
2. The resolution of single quotation marks is faster than double
Variable scope is a variable between the page and function can use each other, its scope of action, the following small series to introduce you to the PHP variable using the domain of some learning notes to get out and exchange with you.
The scope
PHP tutorial data types and variables
PHP is a weak type, a variable that does not need to be declared beforehand, and does not require a specified type. PHP variables are $ plus variable names, PHP variables are case-sensitive. For example, $my = '
PHP pre-defined variables (ii)
Session variable ($_session): The data generated by the session function of PHP are stored in the $_session variable in the way of super global variables.
1. Session Introduction
The session is also known as the
This is the final PHP Basic language Summary, C and C + + some of us do not introduce, we introduce the variables in PHP management three functions, indirect reference to variables, super global variables •, single and double quotes, delimiters, and
PHP implements file upload and multi-file upload ,. PHP implements file upload and multi-file upload. in PHP program development, file upload is a very common function and one of the essential skills of PHP programmers. It is worth noting that file
Preface life always needs to go forward, wait for a day without Alibaba's interview notice, and the mood is quite gloomy, but life is always going on, still need to look forward, do several PHP interview questions, after all, my main development
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.