Question:What is the static variable in function useful for? 

Answer A static variable is defined within a function only the first time and its value can be modified during function calls as follows: <?php function testFunction() { static $testVariable = 1; echo $testVariable; $testVariable++; } testFunction();        //1 testFunction();        //2 testFunction();        //3 ?> 


Deprecated: html_entity_decode(): Passing null to parameter #1 ($string) of type string is deprecated in D:\webserver\www\vcampusbd_com_https\answers\column_answer_two.php on line 128
+ Report
Total Preview: 908
What is the static variable in function useful for?
Copyright © 2024. Powered by Intellect Software Ltd