diff options
author | Lars Strojny <lstrojny@php.net> | 2008-09-11 18:21:37 +0000 |
---|---|---|
committer | Lars Strojny <lstrojny@php.net> | 2008-09-11 18:21:37 +0000 |
commit | fc9c3a17c6fe90220950f841858b16a4376bfefd (patch) | |
tree | 2de480800a7c49cb08f76cae5c2d88369a7e7f70 /ext/standard/tests/array/prev_variation2.phpt | |
parent | c238cb8f848e574beeddf9ecaa6f9d49135fc518 (diff) | |
download | php-git-fc9c3a17c6fe90220950f841858b16a4376bfefd.tar.gz |
MFH: prev()-tests by Iain Lewis <ilewis@uk.ibm.com>
Diffstat (limited to 'ext/standard/tests/array/prev_variation2.phpt')
-rwxr-xr-x | ext/standard/tests/array/prev_variation2.phpt | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/ext/standard/tests/array/prev_variation2.phpt b/ext/standard/tests/array/prev_variation2.phpt new file mode 100755 index 0000000000..0ce087781e --- /dev/null +++ b/ext/standard/tests/array/prev_variation2.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test prev() function : usage variation - Multi-dimensional arrays +--FILE-- +<?php +/* Prototype : mixed prev(array $array_arg) + * Description: Move array argument's internal pointer to the previous element and return it + * Source code: ext/standard/array.c + */ + +/* + * Test prev() when passed: + * 1. a two-dimensional array + * 2. a sub-array + * as $array_arg argument. + */ + +echo "*** Testing prev() : usage variations ***\n"; + +$subarray = array(9,8,7); +end($subarray); + +$array_arg = array ($subarray, 'a' => 'z'); +end($array_arg); + +echo "\n-- Pass a two-dimensional array as \$array_arg --\n"; +var_dump(prev($array_arg)); +var_dump(prev($array_arg)); + +echo "\n-- Pass a sub-array as \$array_arg --\n"; +var_dump(prev($array_arg[0])); +?> +===DONE=== +--EXPECTF-- +*** Testing prev() : usage variations *** + +-- Pass a two-dimensional array as $array_arg -- +array(3) { + [0]=> + int(9) + [1]=> + int(8) + [2]=> + int(7) +} +bool(false) + +-- Pass a sub-array as $array_arg -- +int(8) +===DONE=== |