Not getting what I expect when I try to return an array from my
function. See sample below.
function test()
{
$myArray["one"] = 1;
$myArray["two"] = 2;
return $myArray;
}
$thisArray = test();
foreach($thisAr ray as $thisKey -> $thisVal)
{
echo($thisKey . " is " . $thisVal . "<br>");
}
// The output:
// Should Be: But Is:
// one is 1 Object is
// two is 2 Object is
What's up? How do I pass back an array from a function? I tried
passing it back as an &argument but that doesn't work either.
function. See sample below.
function test()
{
$myArray["one"] = 1;
$myArray["two"] = 2;
return $myArray;
}
$thisArray = test();
foreach($thisAr ray as $thisKey -> $thisVal)
{
echo($thisKey . " is " . $thisVal . "<br>");
}
// The output:
// Should Be: But Is:
// one is 1 Object is
// two is 2 Object is
What's up? How do I pass back an array from a function? I tried
passing it back as an &argument but that doesn't work either.
Comment