Thread: TalkPHP Project
View Single Post
Old 06-22-2008, 04:52 PM   #92 (permalink)
Enfernikus
The Addict
 
Enfernikus's Avatar
 
Join Date: Jun 2008
Posts: 335
Thanks: 2
Enfernikus is on a distinguished road
Default

I am for ternary operators whats the point of..

PHP Code:
if($bUserLoggedIn)
{
     
$szUserName 'Enfernikus';
}
else
{
    
$szUserName 'Argus';

When one could just do this...

PHP Code:

$szUserName 
= ($bUserLoggedIn) ? 'Enfernikus' 'Argus'
Given this is a very simple example and we've not even gone into nested ternary operators.
Enfernikus is offline  
Reply With Quote