(PHP 4 >= 4.0.5, PHP 5)
array_search -- Searches the array for a given value and returns the corresponding key if successful
Searches haystack
for
needle
and returns the key if it is found in
the array, FALSE otherwise.
Óçìåßùóç: If
needle
is a string, the comparison is done in a case-sensitive manner.
Óçìåßùóç: Prior to PHP 4.2.0, array_search() returns NULL on failure instead of FALSE.
If the optional third parameter strict
is set to
TRUE then the array_search()
will also check the types of the needle
in the haystack
.
If needle
is found in
haystack
more than once, the first matching key
is returned. To return the keys for all matching values, use
array_keys() with the optional
search_value
parameter instead.
Ðñïåéäïðïßçóç |
Αυτή η συνάρτηση μπορεί να επιστρέψει Boolean FALSE, αλλά μπορεί επίσης να επιστρέψει και μια non-Boolean τιμή η οποία αποτιμείται σε FALSE, όπως το 0 ή το "". Παρακαλούμε διαβάστε την ενότητα για τα Boolean για περισσότερες πληροφορίρες. Χρησιμοποιείστε τον τελεστή === για να ελέγξετε την τιμή που επιστρέφει αυτή η συνάρτηση. |
See also array_keys(), array_values(), array_key_exists(), and in_array().