If you’re struggeling with regular Expressions I have a great tip for you. Just go to the website RegExr: Online Regular Expression Testing and put your regular expression together!

If you’re struggeling with regular Expressions I have a great tip for you. Just go to the website RegExr: Online Regular Expression Testing and put your regular expression together!

Besides the long if/else notation, the one that you’ll use in most cases, there is also an shorten notation. In this case the ‘ternary operator’ (?) is used.
$var = [condition] ? [true] : [false];
The above is thus another way of scripting for:
if([condition]) { $var = [true]; } else { $var = [false]; }