Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple array question

Status
Not open for further replies.

gokeeffe

Programmer
Jan 11, 2005
170
0
0
IE
Hi

I have the following code that I am using to store values in an array, but is there anyway that I can count the number of items in the array without using the counter that I have, I mean is there any index style array command.

Also: Does any one know any good tutorials on php arrays.

Regards


// Set the counter
$_SESSION['counter']++;

// Set the array
$_SESSION['grind_array'][] = array(
'Interest' => $_SESSION['Interest'],
'Subject' => $_SESSION['Subject'],
'Level' => $_SESSION['Level'],
'counter' => $_SESSION['counter']
);
 
yeah there is, you just use the count function this counts the number of items there are in an array

example
<?php

$A = array("A","B","C");

echo count($A);

?>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top