The Little Guy Posted March 26, 2007 Share Posted March 26, 2007 Can someone explain what the ? and the : are for? Here is an example that I have: echo ($page == $i) ? " <u><b>$i</b></u> " : ' <a href="'.$_SERVER['PHP_SELF'].'?page='.$i; Link to comment https://forums.phpfreaks.com/topic/44298-what-do-these-mean/ Share on other sites More sharing options...
fert Posted March 26, 2007 Share Posted March 26, 2007 this code is the same as if($page==$1) { echo " <u><b>$i</b></u> " } else { echo ' <a href="'.$_SERVER['PHP_SELF'].'?page='.$i; } http://www.php.net/manual/en/language.expressions.php Link to comment https://forums.phpfreaks.com/topic/44298-what-do-these-mean/#findComment-215149 Share on other sites More sharing options...
jitesh Posted March 26, 2007 Share Posted March 26, 2007 This is ternary if condition to decrease line of codes echo ($page == $i) ? " <u><b>$i</b></u> " : ' <a href="'.$_SERVER['PHP_SELF'].'?page='.$i; Link to comment https://forums.phpfreaks.com/topic/44298-what-do-these-mean/#findComment-215151 Share on other sites More sharing options...
The Little Guy Posted March 26, 2007 Author Share Posted March 26, 2007 Thanks. is it only if/else? or is there an else if? Link to comment https://forums.phpfreaks.com/topic/44298-what-do-these-mean/#findComment-215156 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.