The ternary operator and If/Else
Example with "if/else" $true_or_false = true; $need_a_value = ''; if($true_or_false == true) { $need_a_value = 'It was true.'; } else { $need_a_value = 'It was not true.'; }
Example with the ternary operator "?:" $true_or_false = true; $need_a_value = ''; $need_a_value = ($true_or_false==true?'It was true.':'It was not true.');
Leave a Reply
Welcome to Thronic.com
Search this Site
Miscellaneous Links
Recent Articles
- Google-like search suggestion tool
- Linux Bash Color
- Resize a div layer with javascript
- Moving a div layer with javascript
- Web Galaxy » A sci-fi browser game
- Windows 7 on Asus Eee 900 PC
- IE and PHP sessions
- Wordpress 2.8.6 Spell Check Languages
- Reset MySQL Root Password
- Linux hosts file
- IdleGuard
- Column count in SQL
- String encryption in PHP
- Alphanumeric Captcha values in PHP
- Your own numeric Captcha in PHP
