asmith Posted December 4, 2007 Share Posted December 4, 2007 $ aa = array( "1-john","67-john","22-brown"); $b = "john"; preg_match("/([0-9]+)-$b/i",implode(",",$aa),$result) the $result output : array ("1-john"); it is exactlly what i want , what should i change the code to give me all the john's in array ? like : array ("1-john","67-john") ; thanks Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 4, 2007 Share Posted December 4, 2007 use preg_match_all instead of preg_match Quote Link to comment Share on other sites More sharing options...
asmith Posted December 4, 2007 Author Share Posted December 4, 2007 yea too much ! thanks ! sorry about this question :-\ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.