File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / array / bug40709.phpt
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jul 22 01:32:06 2013 UTC (11 years, 3 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17, HEAD
5.4.17

--TEST--
Bug #40709 (array_reduce() behaves strange with one item stored arrays)
--FILE--
<?php
function CommaSeparatedList($a, $b) {
    if($a == null)
        return $b;
    else
        return $a.','.$b;
}

$arr1 = array(1,2,3);
$arr2 = array(1);

echo "result for arr1: ".array_reduce($arr1,'CommaSeparatedList')."\n";
echo "result for arr2: ".array_reduce($arr2,'CommaSeparatedList')."\n";
echo "result for arr1: ".array_reduce($arr1,'CommaSeparatedList')."\n";
echo "result for arr2: ".array_reduce($arr2,'CommaSeparatedList')."\n";

echo "Done\n";
?>
--EXPECT--	
result for arr1: 1,2,3
result for arr2: 1
result for arr1: 1,2,3
result for arr2: 1
Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>