Jump to content

PHP help please :(


goingcrazythankstophp

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.