Forum Moderators: coopster
I have this really annoying problem in a PHP script. I have a function that checks a number of HTML input fields for errors. When it finds an error, a variable called
$error that is set to true. Then, at the end of the script, there is an
if statement that checks to see if $error is true. If it is true, then the function returns false, as well as returning $error_msg, which is an array. The problem I have is that the function does not seem to be returning the array. It returns the false just perfectly, but it refuses to return the array.
I hope this is enough info to work on, and I really appreciate any help.
Thanks*g
function myFunction1()
{
$var = 'MyVariable';
$array = array(
'one' => '001',
'two' => '002'
);
return array($var, $array);
}
list($returnedVar, $returnedArray) = myFunction1();
print '<pre>';
print $returnedVar . "\n";
print_r($returnedArray);
print '</pre>';
exit;