September 2001
Intermediate to advanced
768 pages
32h 45m
English
array preg_grep(string pattern, array strings)
| pattern | Perl regex pattern to match |
| strings | Array of strings to search |
Returns the elements of the input array that match the specified pattern.
Returns:
Array of elements matched
Description:
This function traverses the input array, testing all elements against the supplied pattern. If a match is found, the matching element is returned as part of the array containing all matches.
Since PHP version 4.0.4, the elements in the result array are indexed by the keys they were associated with in the input array. That is, if the element with key 23 in the input array matches, it will be accessible as $outputarray[23]. If this behavior is not desirable, the result array can be run through ...
Read now
Unlock full access