timmah1 Posted December 19, 2008 Share Posted December 19, 2008 How do I count how many items are in an array? Meaning, if I have this code [cdoe] $sports = explode(",", $a['sport']); How can I echo out how many items there are? Thanks in advance Link to comment https://forums.phpfreaks.com/topic/137737-solved-count-items/ Share on other sites More sharing options...
.josh Posted December 19, 2008 Share Posted December 19, 2008 count. I know. Deceptive naming conventions ftl. Link to comment https://forums.phpfreaks.com/topic/137737-solved-count-items/#findComment-719964 Share on other sites More sharing options...
flyhoney Posted December 19, 2008 Share Posted December 19, 2008 <?php echo count($sports); ?> Link to comment https://forums.phpfreaks.com/topic/137737-solved-count-items/#findComment-719968 Share on other sites More sharing options...
timmah1 Posted December 19, 2008 Author Share Posted December 19, 2008 thx Crayon, stupid question, jsut wasn't thining Link to comment https://forums.phpfreaks.com/topic/137737-solved-count-items/#findComment-719978 Share on other sites More sharing options...
.josh Posted December 19, 2008 Share Posted December 19, 2008 I don't know what this 'thining' thing you aren't doing is, but it sounds incredibly important. Do you have any links to tutorials/resources about it? I need to keep up with the standard... Link to comment https://forums.phpfreaks.com/topic/137737-solved-count-items/#findComment-719981 Share on other sites More sharing options...
timmah1 Posted December 20, 2008 Author Share Posted December 20, 2008 Sorry, trying to type to fast. I appreciate your response in my last post, I just stepped into something over my head, and unfortunately, I have to have it done tonight. Could anybody possibly tell me why this only echoe's out 1, when there are actually two? $a['sport'] is listed in database like nba,ncaab echo count($a[sport])."<br>"; Link to comment https://forums.phpfreaks.com/topic/137737-solved-count-items/#findComment-720074 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.