phrozenflame Posted December 31, 2006 Share Posted December 31, 2006 I've got a list of about 350+ numbers, and there' in the 700-800's, but I'd like to know how to do a ffew things:Order them form least to greatestAND // ORCount how many times each number appears, and display the results.How would I go about doing this? Link to comment https://forums.phpfreaks.com/topic/32375-solved-ordering-numbers/ Share on other sites More sharing options...
Nicklas Posted December 31, 2006 Share Posted December 31, 2006 How do you store this list? database, textfile... ? Link to comment https://forums.phpfreaks.com/topic/32375-solved-ordering-numbers/#findComment-150342 Share on other sites More sharing options...
phrozenflame Posted December 31, 2006 Author Share Posted December 31, 2006 Database Link to comment https://forums.phpfreaks.com/topic/32375-solved-ordering-numbers/#findComment-150347 Share on other sites More sharing options...
Orio Posted December 31, 2006 Share Posted December 31, 2006 Q1- If they are in an array, just use the sort() function... If it's a database: use ORDER BY.For the second question (I am assuming again that the numbers are stored in an array), use the array_keys() function with the optional parameter "search_value":[code]<?php//$num contains the number you want to count (how many times it appears)//$array is the array of numbersecho count(array_keys($array, $num));?>[/code]If it's a database, use COUNT.Orio. Link to comment https://forums.phpfreaks.com/topic/32375-solved-ordering-numbers/#findComment-150351 Share on other sites More sharing options...
phrozenflame Posted December 31, 2006 Author Share Posted December 31, 2006 Thanks Link to comment https://forums.phpfreaks.com/topic/32375-solved-ordering-numbers/#findComment-150364 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.