PHP’s numerically indexed array begin with position __.
Correct answer
C. 0
14 views
C. 0
14 views
Numerically indexed arrays in PHP begin at position 0. So in $a = array("x", "y", "z"), $a[0] is "x" and the last element is at index 2.
Zero-based indexing is shared with C, Java and JavaScript, and forgetting it is the classic cause of off-by-one errors in loops.
Practise more Computer Science MCQs with answers and explanations on MCQsExam.com.
Not sure why the answer is C? Ask here and get an explanation.