$keywords = array('red', 'blue', 'yellow', 'green', 'orange', 'white');
$strings = array(
'She had a pink dress',
'I have a white chocolate',
'I have a green balloon',
'I have a chocolate shirt',
'He had a new yellow book',
'We have many blue boxes',
'I have a magenta tie');
实际上,strings
数组非常庞大(50k+条目)。
运行搜索并提取匹配的字符串的最佳方法是什么?
array_filter()
函数。 - jeroen