vendredi 6 novembre 2015

"if else" in php when both "if" and "else" have same actions

I know this is basic, but I can't find an answer. I would like to do the following using PHP:

If A is true
do X
do Y [X has to be executed before Y can be executed]

Else
do just Y [executing X is not required]

Do I need to put Y in twice, as above (i.e., in both the If and the Else statements), or is there a way to write this so that I only have to write Y once?

Aucun commentaire:

Enregistrer un commentaire