PHP : How to avoid isset on array index

February 3rd, 2012 § 0 comments § permalink

I think most of you are fed up with checking each and every array index with isset function. Here is the simple way to avoid isset on array index. When I was a PHP newbie, I used to write code like this to avoid Notice : undefined index “blahblah”

In this case, we are helpless to predict which all index will be missing but we can use a better way which we can make sure that no array indexes will be missing.

Now we can assure that in $data all the index are present. So we can avoid isset checking.

Happy coding.