Static Variable And Its Usage
Sample 1 : What is Static Variable and How to use it?
Static variable is like local variable, but it locates its fake behavior to user.And One More thing, Once it used, it finished.
Age behavior with every year:
Samee age update: 20
Samee age update: 21
Samee age update: 22
<html>
<head>
<title>Static Variable And Its Usage In Function : 3rd Day Lecture of PHP</title>
</head>
<body>
<h1 align="center">Statis Variable And Its Usage</h1>
<h2 align="left">Sample 1 : What is Static Variable and How to use it?</h2>
<?php echo "Static variable is like local variable, but it locates its fake behavior to user.<br />" ?>
<?php echo "And One More thing, Once it used, it finished. <br />" ?>
<?php
echo "<p>Age behavior with every year:</p>";
function age()
{
static $age = 20;
echo "Samee age update: ". $age . "<br />"; //dot operator should be before and after variable.
$age++;
}
age();
age();
age();
?>
</body>
</html>
Post a Comment
Give your reviews about this blog. Leave your comments. what do you think about this post?
Comments Description is given below:
1) I love to read comments, but do not spam.
2) Like this blog and also tweet its posts.
3) You can use some xHTML tags.
4) All Comments are Do Follow, Please try to use blog professionally.
5) Mention Your Name below the comment.
6) You can also suggest for improvement.
7) Do not forget to subscribe Samee Articles blog.
---------------------------------------
Thanks for visiting QWC.Me.
==========================================
For free guidelines contact me on SEO Expert | Samee Ullah Feroz is online there.
==========================================
Best Regards