Home > Database > Mysql Tutorial > Detailed analysis of the role of static variables in MySQL

Detailed analysis of the role of static variables in MySQL

黄舟
Release: 2017-09-14 11:50:04
Original
1622 people have browsed it

This article mainly introduces relevant information that explains the role of static variables in mysql. I hope that through this article, everyone can understand and master the usage of MySQL static variables. Friends in need can refer to the following

Detailed explanation The role of static variables in mysql

Use static variables static variable

Sample code:


##

function Test() 
{ 
$a = 0; 
echo $a; 
$a++; 
}
Copy after login

This function is useless because every time it is called, the value of $a is set to 0 and "0" is output. $a++ that adds one to the variable has no effect, because once you exit this function, the variable $a no longer exists

Sample code:


function Test(){ 
static $a = 0; 
echo $a; 
$a++; 
}
Copy after login

Every time the Test() function is called, the value of $a will be output and incremented by 1; static variables also provide a way to deal with recursive functions. A recursive function is a function that calls itself.

The above is the detailed content of Detailed analysis of the role of static variables in MySQL. For more information, please follow other related articles on the PHP Chinese website!

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