PHP: return array? -
i have index.php, , function.php.
in index.php have included function.php
in index.php im calling login("bla","123"); exists in function.php
in index.php have if (!empty($err)){ foreach(..) echo $err ... }
login() should return array called $err, (with return $err; ) if there errors, , should echo out in foreach in index.php..
but somehow can not work. can't this? im not getting back.
i have in login() :
$err = array(); $err[] = "something went wrong"; return $err; exit(); what's wrong here? or other solution this?
return return returns value of $err. not make variable $err globally available.
try using:
$err = login('bla', '123');
Comments
Post a Comment