mercredi 19 juillet 2017

Check if variable is isset whilst creating new variable

I am attempting to create a dynamic description where the test changes as to what the product characteristics, I have created all separate chunks of text that are set if the product has that feature/characteristic, now I am compiling all the text together for the final description however I need to check if each variable isset whilst creating the variable.

Please see what I am attempting below:

$description = isset($desc1)? echo $desc1 :'' . isset($desc2)? echo $desc2 :';

There will be around 20 different variables which I need to check if they are isset so separate if statements with each different combination of text is not an option. I have done much research and cannot find the solution to this

thank you for any help

Aucun commentaire:

Enregistrer un commentaire