“Nefined offset” Kod odpowiedzi

Niezdefiniowane przesunięcie PHP

If preg_match did not find a match, $matches is an empty array. So you should check if preg_match found an match before accessing $matches[0], for example:

function get_match($regex,$content)
{
    if (preg_match($regex,$content,$matches)) {
        return $matches[0];
    } else {
        return null;
    }
}
Ankur

Nefined offset

The Offset that does not exist in an array then it is called as an undefined offset. Undefined offset error is similar to ArrayOutOfBoundException in Java. If we access an index that does not exist or an empty offset, it will lead to an undefined offset error.
Super Sardine

Odpowiedzi podobne do “Nefined offset”

Pytania podobne do “Nefined offset”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu