Brief description  about Online courses   join in Online courses
View Devendra  Yadav 's Profile

i do not know how to search string with preg_grep function

Create an array “this a test”, search for “test” in this string using preg_grep function.
Asked by Devendra Yadav | Mar 21, 2015 |  Reply now
Replies (2)
View devendra yadav 's Profile
thank you :)
Mar 25, 2015
View teacher siliconindia 's Profile
preg_grep :- This is a function dedicated for just searching elements that matches given regular expression. It will take a regular expression as first parameter, and an array as the second.

example :-

$demo = array (
'hi guys',
'hi silicon',
'hello india',

$matches = preg_grep ('/^hi (\w+)/i', $demo);


Mar 22, 2015