Re: count() & numerical arrays....
| From: | Cesar Cordovez | Date: | Tue, 09 Sep 2003 15:45:32 +0000 |
| Subject: | Re: count() & numerical arrays.... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-162082@lists.php.net to get a copy of this message | ||
Use explode instead...
$num_list_array = explode("," $num_list)
more information at php.net/explode
Cesar
CF High wrote:
Hey all. Another simple, yet baffling for me, question: I have a comma delimited list of numbers; e.g. $num_list = "1,2,3,4" I split the number list to array -- $num_list_array = split("," $num_list) I then count the number of elements -- $count = count($num_list_array); I do not get 4 for $count, rather 1! I can't stand coming up with cludgy workarounds just to count the number of elements in a numerical list..... Any ideas? --Noah --