Forum Moderators: coopster
my array is called $courses and it produces output like this:
Array
(
[1] => Array
(
[FIRST_NAME] => Bob
[LAST_NAME] => Smith
)
[2] => Array
(
[FIRST_NAME] => John
[LAST_NAME] => Townsend
)
)
in the example above there are a total of 2 results but this changes and i want to know how i can determine the total?
thanks
1.) Use the array length as the "total" since your array is already set up consistently this way.
<?
$total = count($courses);
//OR
$total = sizeof($courses);
?>
2.) The second method is to loop through the whole array.
<?
$total = 0;
foreach(array_keys($courses) as $key){
$total+=1;
}
?>