garethhall Posted January 18, 2010 Share Posted January 18, 2010 Hi I have not seen this syntax can some tell what it means? $name_sql = ($newTemplateName===$templateNewname)? '' : "`name`='$newTemplateName',"; Link to comment https://forums.phpfreaks.com/topic/188865-syntax-help/ Share on other sites More sharing options...
salathe Posted January 18, 2010 Share Posted January 18, 2010 If you mean the ?: then that is a ternary operator. Link to comment https://forums.phpfreaks.com/topic/188865-syntax-help/#findComment-997144 Share on other sites More sharing options...
jtgraphic Posted January 18, 2010 Share Posted January 18, 2010 That is an if statement in short hand. It's the same as: if($newTemplateName===$templateNewname) { $name_sql = "`name`='$newTemplateName',"; } Link to comment https://forums.phpfreaks.com/topic/188865-syntax-help/#findComment-997148 Share on other sites More sharing options...
Buddski Posted January 18, 2010 Share Posted January 18, 2010 Actually jtgraphic its not.. It is the same as: if($newTemplateName!==$templateNewname) { $name_sql = "`name`='$newTemplateName',"; } or if($newTemplateName===$templateNewname) { $name_sql = ""; } else { $name_sql = "`name`='$newTemplateName'," } Link to comment https://forums.phpfreaks.com/topic/188865-syntax-help/#findComment-997164 Share on other sites More sharing options...
jtgraphic Posted January 18, 2010 Share Posted January 18, 2010 You're completely correct. I must have gone a little cross-eyed there. Link to comment https://forums.phpfreaks.com/topic/188865-syntax-help/#findComment-997166 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.