Are there any best practices or recommended approaches for efficiently searching arrays with preg_match_all in PHP?

When searching arrays with `preg_match_all` in PHP, it is recommended to use `array_map` to apply the `preg_match_all` function to each element of the array efficiently. This approach allows you to search through the array elements without the need for explicit loops.

// Sample array to search
$array = ['apple123', 'banana456', 'cherry789'];

// Define the pattern to search for
$pattern = '/\d+/';

// Use array_map to apply preg_match_all to each element of the array
$results = array_map(function($item) use ($pattern) {
    preg_match_all($pattern, $item, $matches);
    return $matches[0];
}, $array);

// Output the results
print_r($results);