Monday, 15 April 2013

php - Is there a version of array_keys that works on partial matches? -


I want to return all keys to a PHP array where the respective value has a search element

Works if the value matches the search term exactly, but if the search term is not anywhere in value, but it does not match exactly.

How can I get it?

You can get and receive whatever you want:

 < Code> $ myArray = ['weaving knit', 'hysshet', 'needle point']; $ Search = 'needle'; Use $ Keys = array_keys (array_filter ($ myArray, function ($ value) {$ search} {return (strips ($ value, $ search)! == incorrect);})));  


No comments:

Post a Comment