1--TEST--
2Test prev() function : basic functionality
3--FILE--
4<?php
5/*
6 * Test basic functionality of prev()
7 */
8
9echo "*** Testing prev() : basic functionality ***\n";
10
11$array = array('zero', 'one', 'two');
12end($array);
13echo key($array) . " => " . current($array) . "\n";
14var_dump(prev($array));
15
16echo key($array) . " => " . current($array) . "\n";
17var_dump(prev($array));
18
19echo key($array) . " => " . current($array) . "\n";
20var_dump(prev($array));
21
22echo "\n*** Testing an array with differing values/keys ***\n";
23$array2 = array('one', 2 => "help", 3, false, 'stringkey2' => 'val2', 'stringkey1' => 'val1');
24end($array2);
25$length = count($array2);
26for ($i = $length; $i > 0; $i--) {
27    var_dump(prev($array2));
28}
29
30?>
31--EXPECT--
32*** Testing prev() : basic functionality ***
332 => two
34string(3) "one"
351 => one
36string(4) "zero"
370 => zero
38bool(false)
39
40*** Testing an array with differing values/keys ***
41string(4) "val2"
42bool(false)
43int(3)
44string(4) "help"
45string(3) "one"
46bool(false)
47