The PHP manual says:
empty - determine if the variable is empty
In your case, trim is a function call, not a variable.
If you really want to make your if inline if , you can use something like:
if (!empty($var=trim($_POST['username'])) && !empty($var=trim($_POST['email'])))
Strike>
But it is better to implement:
$username = array_key_exists('username', $_POST) ? trim($_POST['username']) : null; $email = array_key_exists('email', $_POST) ? trim($_POST['email']) : null; if (!empty($username) && !empty($email)) { (...)
Alain tiemblo
source share