mardi 2 mars 2021

Ternary Operator in a php print?

I am trying to use a ternary operator in a print statement like so:

print'<span class="mailbox-attachment-icon"><i class="fa fa-'. $extension == 'zip' ? 'yes' : 'no'  .'"></i></span>';

It is breaking my page every time. I have attempted moving around ''s with no luck. Yes $extension is defined.

How can I get this to work?

Aucun commentaire:

Enregistrer un commentaire