goingcrazythankstophp Posted November 23, 2013 Share Posted November 23, 2013 Anyone have any ideas on how to use PHP count?? Simple example would be good. My project requires me to do a count of how many classmates I have in different classes. Something like this: Class A: 23 Class B: 41 Any kind souls please help Thank you in advance Link to comment https://forums.phpfreaks.com/topic/284191-php-help-please/ Share on other sites More sharing options...
goingcrazythankstophp Posted November 23, 2013 Author Share Posted November 23, 2013 anyone please?? Link to comment https://forums.phpfreaks.com/topic/284191-php-help-please/#findComment-1459650 Share on other sites More sharing options...
JIXO Posted November 23, 2013 Share Posted November 23, 2013 Hi, put your class mates names in an array : $classA = array( 'person1', 'person2', 'person3', 'person4' ); $classB = array( 'person1', 'person2', 'person3', 'person4' ); echo "Class a has ".count($classA)." student<br />"; echo "Class a has ".count($classA)." student<br />"; The documentation page has lots of examples, check them out. Link to comment https://forums.phpfreaks.com/topic/284191-php-help-please/#findComment-1459655 Share on other sites More sharing options...
goingcrazythankstophp Posted November 23, 2013 Author Share Posted November 23, 2013 Hi, put your class mates names in an array : $classA = array( 'person1', 'person2', 'person3', 'person4' ); $classB = array( 'person1', 'person2', 'person3', 'person4' ); echo "Class a has ".count($classA)." student<br />"; echo "Class a has ".count($classA)." student<br />"; The documentation page has lots of examples, check them out. Thank you very much for your help Link to comment https://forums.phpfreaks.com/topic/284191-php-help-please/#findComment-1459668 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.