PHP MCQ PHP Basic MCQ Question #2364
MCQ Single Best Answer Not Set

QWhat will be the output of the following code?
< ?php 
function track() {
static $count = 0;
$count++;
echo $count ;
}
track();
track();
track();
?>

ID: #2364 PHP Basic MCQ 1,235 views
Question Info
#2364Q ID
Not SetDifficulty
PHP Basic MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A 123
  • B 111
  • C 000
  • D 011
Correct Answer: Option A

Explanation

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

Share This Question

Challenge a friend or share with your study group.