In actual programming applications, we often forget the function of STATIC. Reflect carefully. . :)
We use PHP to query data from the database and output the results to the browser. If the results have many rows and the bgcolor of the table is all monochrome, the viewer will feel uncomfortable. So how to make the colors of each row of the table different?
Please see below:
Copy the code The code is as follows:
function getcolor()
{
static $colorvalue;//Define a static variable
if($colorvalue=="#ffffff")
$ colorvalue="#000000";
else $colorvalue="#ffffff";
return($colorvalue);
}
print("
n"); print(" |
The above introduces the code of stay tonya mitchell using static to realize the interlaced display of table colors, including the content of stay tonya mitchell. I hope it will be helpful to friends who are interested in PHP tutorials.