I am aware of the fact that a numerical index on an array starts from the number zero. Is it possible for it to start from the number one? I did not notice any functions in the php manual for this.
Short answer...No. Next answer, have your program skip [0] and start at 1 when building the array. I have rarely found it necessary to do that. I usually just iterate using -1 if need be.
BeRtjh's statement will not work for creating the array, and for accessing the element you need to swap the round brackets for square ones in the echo line.
i.e. the implicit array element creation of $array[] just increments the highest numeric array key. if you have forced the start on a 1 rather than a zero then that's all you need to do.
if you are building your array dynamically from, say, a mysql query try this kind of thing
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.