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 Guidelines:
1) I love to read comments, but please avoid spam.
2) Like this blog, share your insights, and spread the word.
3) You can use basic HTML/xHTML tags.
4) All comments are DoFollow—please use the section professionally.
5) Kindly mention your name or brand below your comment.
6) Constructive suggestions for improvement are always welcome.
7) Do not forget to explore our main agency platform at pingbooster.site.
Thanks for visiting Samee Articles.
========================================
Explore custom digital solutions and WordPress plugins at PingBooster Plugins.
Best Regards,
Samee U. Feroz