Quote:
Originally Posted by Depresie
Since we are talking about this
PHP Code:
number = 1 ? function1 : function 2
I have a question, is there a way to do this without an else ? for example
PHP Code:
number = 1 ? function 1
|
I don't think it's worth it. Things like this are typically done by those that care about the number of lines in their plugin. The focus on code, IMO, should be efficient while also being easy to read and understand. Line count means nothing from a performance perspective and it's usually at the expensive of readability.
However, something like this is fine.
PHP Code:
set_user_health( id , ( iSomeValue == 34 ) ? 90 : 100 );
//instead of
if ( iSomeValue == 34 )
set_user_health( id , 90 );
else
set_user_health( id , 100 );
__________________