Array ( [0] => 'hello' [1] => 'there' [2] => [3] => [4] => 3 ) // how to get the number 5?
count
$arr = Array ( 0 => 'hello', 1 => 'there', 2 => null, 3 => null, 4 => 3, ); var_dump(count($arr));
Conclusion:
INT (5)
count () or sizeof
w/NULL
$array = array('hello', 'there', NULL, NULL, 3); echo "<pre>".print_r($array, true)."</pre><br />"; echo "Count: ".count($array)."<br />";
Array ( [0] => hello [1] => there [2] => [3] => [4] => 3 ) Count: 5
Google PHP-
PHP 5.3.2. int 5.
int 5
$a = array( 0 => 'hello', 1 => 'there', 2 => null, 3 => null, 4 => 3, ); var_dump(count($a));
null, ? , ? ?:)
null
: , :)
echo count($array);