10.01.2009 | My Blog
I’m always lost when I need to find the shorthand version of the if statement in php. That is why I write again a small note for myself so I can find it again.
$value = 'sunny'; $weather = ($value == 'sunny') ? "It is a sunny day" : "Stay in bed its raining"; echo $weather;
There are multiple implementations for the short tag but this is the one I use the most. Maybe I document others too when I feel like it.