I have a pretty nasty error I can’t get rid of. Here’s the function causing the issue:
function get_info_by_WatIAM($WatIAM, $info) {
$users_info = array();
exec("uwdir -v userid={$WatIAM}", $users_info);
foreach ($users_info as $user_info) {
$exploded_info = explode(":", $user_info);
if (isset($exploded_info[1])){
$infoArray[$exploded_info[0]] = $exploded_info[1];
}
}
return $infoArray[$info]; }
Here’s what’s calling the function:
} elseif ( empty(get_info_by_WatIAM($_POST['ownerId'])) ) { ...
I would really appreciate any suggestion. Thanks very much!
If the code doesn’t make sense, here’s a further explanation: exec uses a program that stores information on all the users in a school. These include things like faculty, name, userid, etc. The $_POST['ownerId'] is a username — the idea is that, upon entering a username, all of the user’s information is automatically filled in
You do not need
emptyaround function calls, in factemptyonly works with variables and not functions (as you see). You only needemptyif you want to test a variable that may not be set for thruthiness. It is pointless around a function call, since that function call must exist. Instead simply use:It does the same thing. For an in-depth explanation, read The Definitive Guide To PHP’s isset And empty.