“Sprawdź PHP niezdefiniowane przesunięcie” Kod odpowiedzi

Sprawdź PHP niezdefiniowane przesunięcie

// $key = 10, if $array does not have $array[10] set, it will return false
// If $array[10] has any value, it will return true
if(array_key_exists($key, $array)){}
Fair Fowl

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

Odpowiedzi podobne do “Sprawdź PHP niezdefiniowane przesunięcie”

Pytania podobne do “Sprawdź PHP niezdefiniowane przesunięcie”

Więcej pokrewnych odpowiedzi na “Sprawdź PHP niezdefiniowane przesunięcie” w PHP

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

Przeglądaj inne języki kodu