Annotation of embedaddon/php/ext/standard/tests/array/bug40709.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Bug #40709 (array_reduce() behaves strange with one item stored arrays)
                      3: --FILE--
                      4: <?php
1.1.1.2 ! misho       5: function CommaSeparatedList($a, $b) {
1.1       misho       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: 
1.1.1.2 ! misho      15: echo "result for arr1: ".array_reduce($arr1,'CommaSeparatedList')."\n";
        !            16: echo "result for arr2: ".array_reduce($arr2,'CommaSeparatedList')."\n";
        !            17: echo "result for arr1: ".array_reduce($arr1,'CommaSeparatedList')."\n";
        !            18: echo "result for arr2: ".array_reduce($arr2,'CommaSeparatedList')."\n";
1.1       misho      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>