jeeva Posted March 5, 2007 Share Posted March 5, 2007 hi frnds, can i get count of a paricular value in an array? for example we have a array like $array=array(a,a,a,b,c,a,b,c,a,c); now i want count of 'a'. Result has to come as 5 can i get like this? Link to comment https://forums.phpfreaks.com/topic/41244-is-possible/ Share on other sites More sharing options...
monk.e.boy Posted March 5, 2007 Share Posted March 5, 2007 $array=array('a','a','a','b','c','a','b','c','a','c'); $tmp = array_count_values($array) print $tmp['a']; monk.e.boy Link to comment https://forums.phpfreaks.com/topic/41244-is-possible/#findComment-199804 Share on other sites More sharing options...
monk.e.boy Posted March 5, 2007 Share Posted March 5, 2007 $array=array('a','a','a','b','c','a','b','c','a','c'); $tmp = array_count_values($array); echo $tmp['a']; ooops, missed a ; monk.e.boy Link to comment https://forums.phpfreaks.com/topic/41244-is-possible/#findComment-199806 Share on other sites More sharing options...
jeeva Posted March 5, 2007 Author Share Posted March 5, 2007 its working...........thanks Link to comment https://forums.phpfreaks.com/topic/41244-is-possible/#findComment-199810 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.