PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
anjanesh
DevNet Resident
Posts: 1679 Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India
Post
by anjanesh » Thu Aug 04, 2005 12:59 am
Anyway to get array_search to work with RegExp ?
Code: Select all
$pattern = "/something:.*?/i";
$key = array_search($pattern, $Fields);
Thanks
josh
DevNet Master
Posts: 4872 Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida
Post
by josh » Thu Aug 04, 2005 3:50 am
Use a foreach loop and eragi, break the loop when a match is found (if you only want one match), otherwise build an array of matches.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Aug 04, 2005 7:01 am
ereg are horribly slow.. preg is always the way to do regex.