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 write to an output file in pytion?

Leave a Reply

Your email address will not be published.

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