lundi 2 novembre 2015

PHP - Placing an IF statement into a variable

I want to place an if statement into a variable in order to reduce the lines of code... for example I want to do this:

$empty = if(empty($_POST['username']) && empty($_POST['password']))
if($empty){ // echo message; 
}
elseif(!$empty){ ///echo message; 
}

Can something like the above be produced? Or am I making things too complex?

Aucun commentaire:

Enregistrer un commentaire