scrubbicus Posted June 19, 2009 Share Posted June 19, 2009 $thiscolcats = ($col > $longcols) ? $percol_short : $percol_long; What does that ? and : mean? For some reason I think it's a shorthand way of doing and ifelse. Quote Link to comment https://forums.phpfreaks.com/topic/162850-some-php-syntax-i-dont-know/ Share on other sites More sharing options...
Maq Posted June 19, 2009 Share Posted June 19, 2009 It's called a ternary operator. It is shorthand for an if/else. Converted to if/else it looks like: if($col > $longcols) { $thiscolcats = $percol_short; } else { $thiscolcats = $percol_long; } Quote Link to comment https://forums.phpfreaks.com/topic/162850-some-php-syntax-i-dont-know/#findComment-859324 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.