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. 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; } 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
Archived
This topic is now archived and is closed to further replies.