1--TEST--
2Test count() function : basic functionality
3--FILE--
4<?php
5/* Prototype  : int count(mixed $var [, int $mode])
6 * Description: Count the number of elements in a variable (usually an array)
7 * Source code: ext/standard/array.c
8 */
9
10/*
11 * Test basic functionality of count() using an array as $var argument
12 * and different values as $mode argument.
13 */
14
15echo "*** Testing count() : basic functionality ***\n";
16
17echo "\n-- One Dimensional Array: --\n";
18$array = array('zero', 'one', 'two');
19var_dump(count($array));
20
21echo "\n-- Two Dimensional Array: --\n";
22$array_multi = array('zero', array(1, 2, 3), 'two');
23echo "\$mode = COUNT_NORMAL:    ";
24var_dump(count($array_multi, COUNT_NORMAL));
25echo "\$mode = 0:               ";
26var_dump(count($array_multi, 0));
27echo "\$mode = COUNT_RECURSIVE: ";
28var_dump(count($array_multi, COUNT_RECURSIVE));
29echo "\$mode = 1:               ";
30var_dump(count($array_multi, 1));
31
32echo "Done";
33?>
34--EXPECTF--
35*** Testing count() : basic functionality ***
36
37-- One Dimensional Array: --
38int(3)
39
40-- Two Dimensional Array: --
41$mode = COUNT_NORMAL:    int(3)
42$mode = 0:               int(3)
43$mode = COUNT_RECURSIVE: int(6)
44$mode = 1:               int(6)
45Done