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!!! 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"; } Link to comment https://forums.phpfreaks.com/topic/181453-php-help-for-code/#findComment-957179 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.