Manosmita
Query: 247 / Answer: 251

02nd Apr 2017 .

what is the static variable in function useful for?


Answers

Pratik Samantaray
Query: 21 / Answer: 25

02nd Apr 2017 .

A static variable is defined within a function only the first time and its value can be modified during function calls as follows:

 
 function testFunction() {
static $testVariable = 1;
echo $testVariable; $testVariable++;
}
 
testFunction();        //1 testFunction();        //2 testFunction();        //3 

  •  Information
  • About Forum

    This educational forum is produly developed by betaQsolutions-A leading software company in Odisha. This forum is developed to discuss the educational topics only betweeen the Students, teachers, Parents & Experts. Topic related to Career, Syllabus, Subjects, Questions, Exams etc are allowed to discuss here.

  • Statistics

    Total topics 43 • Total Query 1114 • Total members 247 • Total Answered 1285