Sail E0 Webinar
Question
What will be the output of the following code?
< ?php
function track() {
static $count = 0;
$count++;
echo $count ;
}
track();
track();
track();
?>
Options:
A .  123
B .  111
C .  000
D .  011
Answer: Option A


Because $count is static, it retains its previous value each time the function is executed.



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers