bundyxc Posted September 8, 2009 Share Posted September 8, 2009 So I was on another thread, and I saw this line of code: echo ($page > 1) ? '<a href="?page=' . ($page - 1) . (strlen($search) ? '&search=' . $search : '') .'">prev</a> ' : 'prev '; Anyway, could somebody explain what relevance the first and last question marks have in this line of code? Obviously the middle question mark is passing a HTTP GET request onto the linked page, but I don't understand the question marks (or the colon at the end, either). Thanks for your time. Link to comment https://forums.phpfreaks.com/topic/173499-solved-question-marks-in-code/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 8, 2009 Share Posted September 8, 2009 See Ternary Operator at this link - http://us3.php.net/manual/en/language.operators.comparison.php Link to comment https://forums.phpfreaks.com/topic/173499-solved-question-marks-in-code/#findComment-914540 Share on other sites More sharing options...
bundyxc Posted September 8, 2009 Author Share Posted September 8, 2009 Thank you. Link to comment https://forums.phpfreaks.com/topic/173499-solved-question-marks-in-code/#findComment-914945 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.