ExamVeda
Login
Home
This question belongs to PHP Basic PHP
Basic PHP
?

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

Answer & Solution
Correct Answer: Option A
Because $count is static, it retains its previous value each time the function is executed.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.