Annotation of embedaddon/php/ext/standard/tests/array/bug40709.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #40709 (array_reduce() behaves strange with one item stored arrays)
3: --FILE--
4: <?php
5: function CommaSeperatedList($a, $b) {
6: if($a == null)
7: return $b;
8: else
9: return $a.','.$b;
10: }
11:
12: $arr1 = array(1,2,3);
13: $arr2 = array(1);
14:
15: echo "result for arr1: ".array_reduce($arr1,'CommaSeperatedList')."\n";
16: echo "result for arr2: ".array_reduce($arr2,'CommaSeperatedList')."\n";
17: echo "result for arr1: ".array_reduce($arr1,'CommaSeperatedList')."\n";
18: echo "result for arr2: ".array_reduce($arr2,'CommaSeperatedList')."\n";
19:
20: echo "Done\n";
21: ?>
22: --EXPECT--
23: result for arr1: 1,2,3
24: result for arr2: 1
25: result for arr1: 1,2,3
26: result for arr2: 1
27: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>