Check if any of array elements exists in another array (with PHP)

Code:



// check if at least one of Paris, Roma or Dublin exists in the $cities_list (Array)
if (  !empty(array_intersect( ['Paris', 'Roma', 'Dublin'], $cities_list) )  ) {
    // do something
}

Neuen Kommentar schreiben

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

Suche

Neueste Kommentare