There are many errors in PHP that are like siblings: undefined variable, undefined property, and undefined index for instance — and they all range in severity based on circumstance. Whereas the undefined variable error is fairly fast to diagnose (seek out the line reported and see if its simply misspelled or never initialized), the undefined index error might require a deep dive into an entire chain of logic. Because this is an index into an array, and thus might be as simple as a misspelled constant, or itself a variable being set by some other function that you have to go chase down.¹
Thus, an index is simply a key that exists in an array.
Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox.Explore