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. Quote 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 Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.