200-710 Exam QuestionsBrowse all questions from this exam

200-710 Exam - Question 25


What is the output of the following code?

Show Answer
Correct Answer: A,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

1 comment
Sign in to comment
kleckioksOption: B
Nov 12, 2021

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

mikedename
Nov 21, 2021

No, answer A is correct.