Local variables1> definition: A variable defined inside a function, called a local variable. Formal parameters also belong to local variables.2> Scope: A local variable is only valid within the function that defines it, that is, the local variable
Copy Code code as follows:
if (defined (' Const_name ')) {
Do something
}
Variable detection is the use of isset, note that the variable is not declared or declared when the assignment is Null,isset return false, such as:
In php, static is a static variable. It can define a function. The variable is a global static variable, so how does adding static before a function or variable affect the function and variable? Let's take a look at it.
1) The description of
Copy codeThe Code is as follows:If (defined ('const _ name ')){// Do something}
Isset is used for variable detection. Note that if the variable is not declared or declared, the value is NULL, and isset returns FALSE, for example:
Copy codeThe Code
Welcome to the Linux community forum and interact with 2 million technical staff. Any other expressions cannot be passed through the reference, and the result is undefined. For example, the example passed by reference below is invalid :?
What are the differences between static global variables and common global variables, static local variables and common local variables? This article will answer your questions one by one.
What are the differences between static global variables and
If you understand the above sentence, then the next is nonsense, the PHP manual is written in a very full. In a word, I solved all the problems in my title.
The code is as follows:
if (defined (' Const_name ')) { //do something}
Variable
Constant detection uses defined, and defining constants is define. Note the constants to be detected need to use quotation marks (single and double), such as:
The code is as follows
if (defined (' Const_name ')) {Do something}
Variable detection
Copy CodeThe code is as follows:
if (defined (' Const_name ')) {
Do something
}
Variable detection is the use of isset, note that variables are not declared or declared when the assignment value is Null,isset return false, such as:
Copy the Code
Static global variable and normal global variable, static local variable and ordinary local variable, static function and ordinary function difference? The following article will answer for you.
(1) The description of the global variable
Defined is used for constant detection, and define is used for defining constants. Note that the constants to be detected must be enclosed in quotation marks (single and double quotation marks), for example: The code is as follows:Copy code If
Table 1-6 common command line options of the GNU make command
Definition of command line options-C dir changes to the specified directory DIR before reading makefile.-F FILE uses the specified FILE as the makefile.-H: all make options are displayed.-
Let's talk about static variables and static functions in C. (1) static variables in C are stored in the global storage zone, which is different from automatic variables stored in the stack. The key difference between the two is their scope. The
Static variables and static functions pose a lot of troubles for beginners of c and c ++. I discussed this with my roommate last night.
Question:Although c and c ++ are twins in the eyes of many people, there are still many differences. Here we will
This article introduces some techniques for Delphi to penetrate OOP constraints.
Access protected
(Protected)
Variable
If it is a protection variable of a class, you can access it anywhere by using the following methods:
Type
Tsomeclassaccess
1 the global variable (external variable) before the description and then the static to form a global variable. The global variable itself is the static storage mode, static global variables are of course also static storage mode. The two are not
variables:
binding
fn Main () {let
x = 5;//let keyword is used to declare a binding let
(A, b) = (1, 2);//Python-like syntax, called pattern let
t:i32 = 5;//in rust add an Add type is a 32-bit integer
}
The above code will be compiled
Common system variables:
SY-SUBRC execution statusSY-DATUM server dateSY-UZEIT server timeThe number of SY-INDEX loops (do while)Index of the inner table currently processed by the SY-TABIXSY-LINSZ current report widthSY-UNAME UsernameSY-TCODE
If static is a static variable in PHP, and he can define a function, and the variable is a global static variable, then how do we add static to the function or variable that will affect the functions and variables, let's look at it together.
1)
#! /Bin/bash
Hello = "var1"
Echo $ hello
Function func1 # define function func1
{
Local Hello = "var2" # define the internal variable hello
Echo $ hello
}
Func1 # Call a function
Echo $ hello
Execution result:
Conclusion: local variables only work
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.