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 Link to comment https://forums.phpfreaks.com/topic/80096-solved-find-more-what-should-i-change/ 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 Link to comment https://forums.phpfreaks.com/topic/80096-solved-find-more-what-should-i-change/#findComment-405903 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 :-\ Link to comment https://forums.phpfreaks.com/topic/80096-solved-find-more-what-should-i-change/#findComment-405909 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.