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 Quote Link to comment Share on other sites More sharing options...
goingcrazythankstophp Posted November 23, 2013 Author Share Posted November 23, 2013 anyone please?? Quote Link to comment Share on other sites More sharing options...
Solution JIXO Posted November 23, 2013 Solution Share Posted November 23, 2013 (edited) 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. Edited November 23, 2013 by JIXO Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.