how to search an array in php?
问题 suppose I have an array of names, what I want is that I want to search this particular array against the string or regular expression and then store the found matches in another array. Is this possible ? if yes then please can your give me hint ? I am new to programming. 回答1: what you would need to di is map the array with a callback like so: array_filter($myarray,"CheckMatches"); function CheckMatches($key,$val) { if(preg_match("...",$val,$match)) { return $match[2]; } } This will run the