1--TEST--
2Test sizeof() function : basic functionality - for scalar types
3--FILE--
4<?php
5/* Prototype  : int sizeof(mixed $var[, int $mode] )
6 * Description: Counts an elements in an array. If Standard PHP library is
7 *              installed, it will return the properties of an object.
8 * Source code: ext/standard/basic_functions.c
9 * Alias to functions: count()
10 */
11
12/* Testing the sizeof() for some of the scalar types(integer, float) values
13 * in default, COUNT_NORMAL and COUNT_RECURSIVE modes.
14 */
15
16echo "*** Testing sizeof() : basic functionality ***\n";
17
18$intval = 10;
19$floatval = 10.5;
20$stringval = "String";
21
22echo "-- Testing sizeof() for integer type in default, COUNT_NORMAL and COUNT_RECURSIVE modes --\n";
23echo "default mode: ";
24var_dump( sizeof($intval) );
25echo "\n";
26echo "COUNT_NORMAL mode: ";
27var_dump( sizeof($intval, COUNT_NORMAL) );
28echo "\n";
29echo "COUNT_RECURSIVE mode: ";
30var_dump( sizeof($intval, COUNT_RECURSIVE) );
31echo "\n";
32
33echo "-- Testing sizeof() for float  type in default, COUNT_NORMAL and COUNT_RECURSIVE modes --\n";
34echo "default mode: ";
35var_dump( sizeof($floatval) );
36echo "\n";
37echo "COUNT_NORMAL mode: ";
38var_dump( sizeof($floatval, COUNT_NORMAL) );
39echo "\n";
40echo "COUNT_RECURSIVE mode: ";
41var_dump( sizeof($floatval, COUNT_RECURSIVE) );
42
43echo "Done";
44?>
45--EXPECTF--
46*** Testing sizeof() : basic functionality ***
47-- Testing sizeof() for integer type in default, COUNT_NORMAL and COUNT_RECURSIVE modes --
48default mode: int(1)
49
50COUNT_NORMAL mode: int(1)
51
52COUNT_RECURSIVE mode: int(1)
53
54-- Testing sizeof() for float  type in default, COUNT_NORMAL and COUNT_RECURSIVE modes --
55default mode: int(1)
56
57COUNT_NORMAL mode: int(1)
58
59COUNT_RECURSIVE mode: int(1)
60Done
61