Exam 200-710 All QuestionsBrowse all questions from this exam
Question 25

What is the output of the following code?

    Correct Answer: D

    The loop initializes $i with 0 and iterates as long as $i is less than 1.02, incrementing $i by 0.17 each iteration. The values assigned to $i during the iterations are 0, 0.17, 0.34, 0.51, 0.68, 0.85, and 1.02 (but 1.02 doesn't fulfill the loop condition, so it's excluded). Therefore, the array $a will have keys with 0, 0.17, 0.34, 0.51, 0.68, and 0.85. The count of unique keys in the array $a is 7.

Discussion
kleckioksOption: B

Answer is B (2). Code: <?php for ($i = 0; $i < 1.2; $i += 0.17) { $a[$i] = $i; } echo count($a);

mikedename

No, answer A is correct.