alexislalas Posted November 14, 2009 Share Posted November 14, 2009 Hello, What is the logic behind the following code? <?php echo $st['puntos']>0?$st['puntos']:'0';?> Thanks!!! Quote Link to comment https://forums.phpfreaks.com/topic/181453-php-help-for-code/ Share on other sites More sharing options...
Maq Posted November 14, 2009 Share Posted November 14, 2009 This logic is known as the ternary operator. (search for "ternary") Converted to an if/else: if($st['puntos'] > 0) { echo $st['puntos']; } else { echo "0"; } Quote Link to comment https://forums.phpfreaks.com/topic/181453-php-help-for-code/#findComment-957179 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.