7. Variable Variable and Static Variable

Variable Variable:

	echo $Bangladesh;

Static variable:Normally, when a function is completed/executed, all of its variables are deleted. However, sometimes we want a local variable NOT to be deleted. We need it for a further job. A static variable will not lose its value when the function exits and will still hold that value should the function be called again

	function myTest() {
		static $x = 0;
		echo $x;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s