How do i fix "notice: undefined offset" in php?
Example:
$arr = array("apple");
echo $arr[1];
This notice is shown when you try to access an array element using an index that doesn't exist.
Solution:
if (isset($arr[1])) {
echo $arr[1];
}
Example: Solution:How do i fix "notice: undefined offset" in php?
This notice is shown when you try to access an array element using an index that doesn't exist.
$arr = array("apple");
echo $arr[1];
if (isset($arr[1])) {
echo $arr[1];
}