In PHP, how is the first element accessed if $a represents an array with numeric indices?
A. $a[1]
B. $a[0]
C. $a.1
D. $a.0
Answer: Option B
Solution (By Examveda Team)
This question is asking about how to access the very first item in an array called "$a". Arrays in PHP are like lists, and each item has a number called an index. These indices start from zero.Think of it like a numbered list:
* The first item is at index 0.
* The second item is at index 1.
* And so on.
So, to get the first element of the array "$a", you would use "$a[0]".
Therefore, the correct answer is Option B: $a[0].

Join The Discussion