Eugene Posted November 13, 2006 Share Posted November 13, 2006 [code=php:0]something ? something : something[/code]What is that / How does it work? Link to comment https://forums.phpfreaks.com/topic/27059-what-does/ Share on other sites More sharing options...
Destruction Posted November 13, 2006 Share Posted November 13, 2006 It's the ternary/tertiary operator (I believe, I can never remember which one or if it's called both). It's a shorthand IF statement...[code]$page = is_numeric($_GET['page']) ? $_GET['page'] : 1;[/code]This means if $_GET['page'] is numeric then $page = $_GET['page']. If it isn't, then $page = 1.test_condition ? true : false.HTHDest Link to comment https://forums.phpfreaks.com/topic/27059-what-does/#findComment-123765 Share on other sites More sharing options...
doni49 Posted November 13, 2006 Share Posted November 13, 2006 It's a ternary comparison.http://us2.php.net/ternary Link to comment https://forums.phpfreaks.com/topic/27059-what-does/#findComment-123766 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.