diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/standard/tests/array/sizeof_basic1.phpt | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/standard/tests/array/sizeof_basic1.phpt')
-rw-r--r-- | ext/standard/tests/array/sizeof_basic1.phpt | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/ext/standard/tests/array/sizeof_basic1.phpt b/ext/standard/tests/array/sizeof_basic1.phpt new file mode 100644 index 0000000..dea4a68 --- /dev/null +++ b/ext/standard/tests/array/sizeof_basic1.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test sizeof() function : basic functionality - for scalar types +--FILE-- +<?php +/* Prototype : int sizeof(mixed $var[, int $mode] ) + * Description: Counts an elements in an array. If Standard PHP library is + * installed, it will return the properties of an object. + * Source code: ext/standard/basic_functions.c + * Alias to functions: count() + */ + +/* 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: int(1) + +COUNT_NORMAL mode: int(1) + +COUNT_RECURSIVE mode: int(1) + +-- Testing sizeof() for float type in default, COUNT_NORMAL and COUNT_RECURSIVE modes -- +default mode: int(1) + +COUNT_NORMAL mode: int(1) + +COUNT_RECURSIVE mode: int(1) +Done |