Thursday, 5 September 2013

php terniary operators, trying to increment a value

php terniary operators, trying to increment a value

how can I increment x using a ternary operator?
I've tried $x = $x==2 ? 0 : ++; but.. obviously it didn't work.
if($x == 2 ){
$x=0;
}else{
$x++;
}
Thanks

No comments:

Post a Comment