Hay all, I have an if
statement. How could I make this as short as possible?
if ( $a < 0 ){
if( $a > -2 ){
echo "standard";
}elseif( $a <= -2 && $a > -4 ){
echo "thin";
}elseif( $a <= -4 ){
echo "super thin";
}
}else{
if( $a < 2 ){
echo "standard";
}
if( $a > 2.01 && $a <= 4){
echo "thin";
}
if( $a > 4.01 && $a <= 8.00){
echo "super thin";
}
}
EDIT: basically $a
will be any number (positive or negative) and we match it like this.
If the value is
- +0.00 to +/- 2.00 – Standard
- +/- 2.25 to +/- 4.00 – Thin
- +/- 4.25 to +/- 8.00 – Super Thin
Extra marks for anyone who knows what this might be used for :)