Static is to define a static object or static variable. After reading the related examples in this article, we will be able to understand the features of static variables or class methods.
1. Create an object $ object = new Class () and then use "->"
After php4.1.0, http_get_vars is saved using the get variable. The get variable mainly comes from the following methods:
For example, the URL that requests the server to obtain information, use the form method as the get method. In this way, all
1. Variable declaration:
If you use data multiple times, declare it as a variable.
$ Variable name = Value
In a strongly typed language (C, Java), you must specify the type before declaring a variable.
PHP is a weak language, and the variable type
A valid variable name in PHP starts with a letter or underline, followed by any number of letters, numbers, or underscores. According to the normal regular expression, it will be expressed as: '[a-zA-Z _ \ x7f-\ xff] [a-zA-Z0-9 _ \ x7f-\ xff] *'.
When the error message syntaxerror, unexpectedT_ENCAPSED_AND_WHITESPACE, expectingT_STRINGorT_VARIABLEorT_NUM_STRING is displayed, the error message is displayed.
Syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE
This article mainly introduces the usage of smarty variable modifier in php. Examples of common techniques for modifying smarty template variables are analyzed. For more information, see
This article mainly introduces the usage of smarty variable
1, for
PHP
file, the introduction of variables in double quotation marks requires adding
{
Variable name
}
;
. variable name or . Variable name . ;
$a = "gegweg{$demo};
$a = "Gegweg". $demo;
$a = "Gegweg". $demo." Fweffwef ";
2, for The JS file,
Static variables only exist in the function scope, and static variables only exist in the stack. The next time you call this function, the value of this variable is retained. the static variable only exists in the function scope, and the static
Static keyword
declares aProperty
or a method is related to a class and not to a particular instance of a class, so such a property or method is also referred to as a class attribute or class method.
If the access Control permission allows, you
Variable variable, variable name of a variable can be set and used dynamically. Grammar form is the special syntax of PHP, other languages are rare, this article to share PHP variable learning Summary, the knowledge of PHP variables interested in
Starting with PHP 4.2.0, the default value of Register_globals is off, so many variables that can be used directly, such as $PHP _self or set session variables, cannot be accessed in the form of "$ variable name", which can cause a lot of
How can I understand the scope in php? next we will introduce the local variables: variables declared inside the function. Global variables: variables declared outside the function.
How can I understand the scope in php? next we will introduce local
PHP environment variables include $ GLOBALS [], $ _ SERVER [], $ _ GET [], $ _ POST [], $ _ COOKIE [], $ _ FILES [], $ _ ENV [], $ _ REQUEST [], and $ _ SESSION []. $ _ GET and $ _ POST are mainly for the data submitted by FORM forms, and $ _ COOKIE
This article mainly introduces the difference between static class and static variable usage in PHP, analyzes the definition, function and use skill of static class and static variable in PHP in detail, and needs friends to refer to
This paper
: This article mainly introduces the significance of variables related to PHP ---- $ _ SERVER ---. For more information about PHP tutorials, see.
These are also found online, hoping to help you.
$ _ SERVER ['remote _ port'] // PORT. $ _ SERVER
When some large variables (such as arrays or objects) are no longer used in the program, it is necessary to delete them first: $ varname = null
Method 2: unset ($ varname)
Both methods can delete variables, but the results are slightly different.
Common php pre-defined variables can be added to your favorites for future use.
The code is as follows:
Echo "current operating system information". PHP_ OS ."";Echo 'file path and FILE name: '. _ FILE __.'';Echo "current PHP version
Use the GET variable in PHP after PHP4.1.0 to save HTTP_GET_VARS with The GET variable. The GET variable mainly comes from the following methods:
For example, the URL that requests the server to obtain information, use the form method as the get
1. assign values to variables after they are declared. There are two ways to assign values: value assignment and reference assignment. 1. value assignment $ color & quot; red & quot; $ sum12 + & quot; 15 & quot; * $ sum
I. variable assignment
You
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.