krs10_s Posted March 12, 2009 Share Posted March 12, 2009 i need to display how many times a value appears in a array. Eg: in array: 1,2,4,3,2,4,1,2,3,4 how many 1's and 2's and 3's etc???? Link to comment https://forums.phpfreaks.com/topic/149089-diplay-number-of-times-a-value-appears-in-the-array/ Share on other sites More sharing options...
Mikedean Posted March 12, 2009 Share Posted March 12, 2009 http://uk.php.net/function.array-count-values That should do it Link to comment https://forums.phpfreaks.com/topic/149089-diplay-number-of-times-a-value-appears-in-the-array/#findComment-782839 Share on other sites More sharing options...
krs10_s Posted March 12, 2009 Author Share Posted March 12, 2009 Here is my code i need to work with. so now i need to diplay the amount of times each value appears <?php $text=$_POST['text']; $words=explode(' ',$text); sort($words); foreach($words as $no=>$words) { print "<tr><td>$no</td><td>$words</td></tr>"; } ?> Link to comment https://forums.phpfreaks.com/topic/149089-diplay-number-of-times-a-value-appears-in-the-array/#findComment-782861 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.