Explain what is the static variable in function useful for?
Submitted by: AdministratorA 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
?-->
Submitted by:
<!--?php
function testFunction()
{
static $testVariable = 1;
echo $testVariable;
$testVariable++;
}
testFunction(); //1
testFunction(); //2
testFunction(); //3
?-->
Submitted by:
Read Online Junior Developer PHP Job Interview Questions And Answers
Top Junior Developer PHP Questions
☺ | Tell me how the result set of Mysql be handled in PHP? |
☺ | Tell me whether it is possible to share a single instance of a Memcache between multiple PHP projects? |
☺ | Do you know what does $GLOBALS means? |
☺ | Please explain is it possible to use COM component in PHP? |
☺ | Explain how can PHP and Javascript interact? |
Top Web Developer Categories
☺ | Bootstrap Interview Questions. |
☺ | Front End Web Developer Interview Questions. |
☺ | Typography Interview Questions. |
☺ | Laravel PHP Developer Interview Questions. |
☺ | Junior Developer PHP Interview Questions. |