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/each_basic.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/each_basic.phpt')
-rw-r--r-- | ext/standard/tests/array/each_basic.phpt | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/ext/standard/tests/array/each_basic.phpt b/ext/standard/tests/array/each_basic.phpt new file mode 100644 index 0000000..350b40f --- /dev/null +++ b/ext/standard/tests/array/each_basic.phpt @@ -0,0 +1,74 @@ +--TEST-- +Test each() function : basic functionality +--FILE-- +<?php +/* Prototype : array each(array $arr) + * Description: Return the currently pointed key..value pair in the passed array, + * and advance the pointer to the next element + * Source code: Zend/zend_builtin_functions.c + */ + +/* + * Test basic functionality of each() + */ + +echo "*** Testing each() : basic functionality ***\n"; + +$arr = array ('one' => 1, 'zero', 'two' => 'deux', 20 => 'twenty'); +echo "\n-- Passed array: --\n"; +var_dump($arr); + +echo "\n-- Initial position: --\n"; +var_dump(each($arr)); + +echo "\n-- End position: --\n"; +end($arr); +var_dump(each($arr)); + +echo "\n-- Passed the end of array: --\n"; +var_dump(each($arr)); + +echo "Done"; +?> +--EXPECTF-- +*** Testing each() : basic functionality *** + +-- Passed array: -- +array(4) { + ["one"]=> + int(1) + [0]=> + string(4) "zero" + ["two"]=> + string(4) "deux" + [20]=> + string(6) "twenty" +} + +-- Initial position: -- +array(4) { + [1]=> + int(1) + ["value"]=> + int(1) + [0]=> + string(3) "one" + ["key"]=> + string(3) "one" +} + +-- End position: -- +array(4) { + [1]=> + string(6) "twenty" + ["value"]=> + string(6) "twenty" + [0]=> + int(20) + ["key"]=> + int(20) +} + +-- Passed the end of array: -- +bool(false) +Done
\ No newline at end of file |