Question
What will be the output of the following code?
< ?php
function track() {
static $count = 0;
$count++;
echo $count ;
}
track();
track();
track();
?>
< ?php
function track() {
static $count = 0;
$count++;
echo $count ;
}
track();
track();
track();
?>
Answer: Option A
Was this answer helpful ?
Because $count is static, it retains its previous value each time the function is executed.
Was this answer helpful ?
More Questions on This Topic :
Question 5. PHP files have a default file extension of. ....
Question 7. Who is the father of PHP? ....
Submit Solution