Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- Bug #40709 (array_reduce() behaves strange with one item stored arrays) --FILE-- ..

Decoded Output download

--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')."
";
echo "result for arr2: ".array_reduce($arr2,'CommaSeparatedList')."
";
echo "result for arr1: ".array_reduce($arr1,'CommaSeparatedList')."
";
echo "result for arr2: ".array_reduce($arr2,'CommaSeparatedList')."
";

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

Did this file decode correctly?

Original Code

--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

Function Calls

array_reduce 1

Variables

$arr1 [{'key': 0, 'value': 1}, {'key': 1, 'value': 2}, {'key': 2, 'value': 3}]
$arr2 [{'key': 0, 'value': 1}]

Stats

MD5 9c50936881cee650b1c2ad6265340b75
Eval Count 0
Decode Time 93 ms