September 2001
Intermediate to advanced
768 pages
32h 45m
English
bool in_array(mixed target, array array, [bool compare_types])
| target | Value for which to search |
| array | Array in which to search for target |
| compare_types | Whether to compare types or just values |
Searches an array for an occurrence of a given value.
Returns:
TRUE if the target value exists within the given array; FALSE otherwise
Description:
This function searches through array for an element with the value given by target . If compare_types is given and is TRUE, elements match only if they have the same value and type as target ; otherwise, only the values need to match.
Version:
PHP 4
Example:
$array = array(1, 2, '3', 4); if (in_array(3, $array)) { echo "Found.\n"; } else { echo ... |
Read now
Unlock full access