Getting array size : Array Index « Data Structure « PHP
- PHP
- Data Structure
- Array Index
Getting array size
<html>
<head>
<title>Getting array size</title>
</head>
<body>
<ul>
<?php
$arr = array();
for( $i = 0; $i < 3; $i++ )
{
$arr[ $i ] ="<li>This is element $i</li>";
}
foreach( $arr as $value )
{
echo($value);
}
$size = count( $arr );
echo( "<li>Total number of elements is $size </li>" );
?>
</ul>
</body>
</html>
Related examples in the same category