summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/sizeof_basic1.phpt
blob: 68dcc52a23efc34044efeebb602a01fc9de99055 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
--TEST--
Test sizeof() function : basic functionality - for scalar types
--FILE--
<?php
/* Testing the sizeof() for some of the scalar types(integer, float) values
 * in default, COUNT_NORMAL and COUNT_RECURSIVE modes.
 */

echo "*** Testing sizeof() : basic functionality ***\n";

$intval = 10;
$floatval = 10.5;
$stringval = "String";

echo "-- Testing sizeof() for integer type in default, COUNT_NORMAL and COUNT_RECURSIVE modes --\n";
echo "default mode: ";
var_dump( sizeof($intval) );
echo "\n";
echo "COUNT_NORMAL mode: ";
var_dump( sizeof($intval, COUNT_NORMAL) );
echo "\n";
echo "COUNT_RECURSIVE mode: ";
var_dump( sizeof($intval, COUNT_RECURSIVE) );
echo "\n";

echo "-- Testing sizeof() for float  type in default, COUNT_NORMAL and COUNT_RECURSIVE modes --\n";
echo "default mode: ";
var_dump( sizeof($floatval) );
echo "\n";
echo "COUNT_NORMAL mode: ";
var_dump( sizeof($floatval, COUNT_NORMAL) );
echo "\n";
echo "COUNT_RECURSIVE mode: ";
var_dump( sizeof($floatval, COUNT_RECURSIVE) );

echo "Done";
?>
--EXPECTF--
*** Testing sizeof() : basic functionality ***
-- Testing sizeof() for integer type in default, COUNT_NORMAL and COUNT_RECURSIVE modes --
default mode: 
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)

COUNT_NORMAL mode: 
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)

COUNT_RECURSIVE mode: 
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)

-- Testing sizeof() for float  type in default, COUNT_NORMAL and COUNT_RECURSIVE modes --
default mode: 
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)

COUNT_NORMAL mode: 
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)

COUNT_RECURSIVE mode: 
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)
Done