Skip to content

How to prevent the Undefined index in PHP?

// Your array index has no value or is not referencing anything,
// The easiest way to overcome this is to simply check whether
// it has been defined
if (isset($arr[$i])) {
	// Do something
}
See also  Python code snippet - How to turn vs into a executable?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.