How To Count Elements In An Array Find How Many Values Arrays
RegisterLogin
How To Count Elements In An Array Find How Many Values Arrays
Post Description: How To Count Elements In An Array Find How Many Values Arrays
Tags: How, To, Count, Elements, In, An, Array, Find, How, Many, Values, Arrays
This Post Was Posted On Feb 29, 2008 By web hosting #1305
Post Description: How To Count Elements In An Array Find How Many Values Arrays
Tags: How, To, Count, Elements, In, An, Array, Find, How, Many, Values, Arrays
This Post Was Posted On Feb 29, 2008 By web hosting #1305
How To Count Elements In An Array Find How Many Values Arrays by web hosting
PHP CODE
<?php
$a[0] = 1;
$a[1] = 3;
$a[2] = 5;
$result = count($a);
// $result == 3
$b[0] = 7;
$b[5] = 9;
$b[10] = 11;
$result = count($b);
// $result == 3
$result = count(null);
// $result == 0
$result = count(false);
// $result == 1
?>
$a[0] = 1;
$a[1] = 3;
$a[2] = 5;
$result = count($a);
// $result == 3
$b[0] = 7;
$b[5] = 9;
$b[10] = 11;
$result = count($b);
// $result == 3
$result = count(null);
// $result == 0
$result = count(false);
// $result == 1
?>
an easy one is this code also to help you explain how to use this function:
<?
$count = array('1','2','3');
echo '<h1>'.count($count).'</h1>';
?>
OUTPUT: 3
for more information about this function go to http://www.php.net/manual/en/function.count.php
Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
hostman
#1736 1
Feb 22, 2008 Reply Report abuse
©2011 Webune Forums - Wed Dec 21, 2011 5:25 am
Powered by: Webune Forums V3
Powered by: Webune Forums V3