Home > Backend Development > PHP Tutorial > PHP Language Basics 04 By ACReaper_PHP Tutorial

PHP Language Basics 04 By ACReaper_PHP Tutorial

WBOY
Release: 2016-07-14 10:12:23
Original
960 people have browsed it

This is the last summary of the basic language of PHP. We will not introduce C and C++. We will introduce the three functions of variable management in PHP, indirect reference of variables, super global variables, single and double quotation marks, delimiters, Everything else is the same as C and C++.

04.01 Three functions of variable management
isset(), unset(), empty()
One is to determine whether the variable exists, and the other is to release the variable (release the memory, if and only if the change variable has only one pointer, or the memory corresponding to the variable has no alias, otherwise the variable is just released, remember the variables of PHP In fact, it is essentially a pointer)
eg:
$name = "sususu"
$test = & $name;
unset($name);
Print $name;//An error will occur.
print $test;//can be executed
It can be inferred that using unset releases two parts of memory, one part is the memory occupied by $name itself, and the other part is the memory at the address pointed to by $name.
As for the empty() function, it is actually used to determine whether a variable exists. If it exists, whether it is assigned a value. If the value is assigned, whether it is false. If so, it returns true
04.02 Indirect reference of variables
The so-called indirect reference of a variable is that the value stored in the variable can be used as the variable name.
$name = "aaa"
$$name = "bbb";
print aaa;//output bbb
04.03 Super global variable
$_GET[], $_POST[], $SERVER[], $COOKIE[], $_ENV[] can be accessed at any location as global arrays in C language.
04.04 Single quotes
Double quotes can parse variables in strings, but single quotes cannot, so from an efficiency point of view, single quotes are of course more efficient!
On the contrary, single quotes can only parse escaped single quotes ' and escaped backslashes in strings\

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477207.htmlTechArticleThis is the last summary of the basic language of PHP. We will not introduce C and C++. We will introduce PHP. The three functions of variable management, indirect reference of variables, super global variables, single and double quotes...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template