Edit report at http://bugs.php.net/bug.php?id=32059&edit=1

 ID:                 32059
 Comment by:         scratch65535 at att dot net
 Reported by:        scooley at apple dot com
 Summary:            ranges in switch
 Status:             Open
 Type:               Feature/Change Request
 Package:            Feature/Change Request
 Operating System:   mac os x
 PHP Version:        5.0.3
 Block user comment: N

 New Comment:

I too think it would be very convenient to allow a range as a case,
e.g.



switch( $somevar )

{

    case 1..5 :

        // code & break

    case 6..23 : 

        // code & break

    // etc

}



(I also think it'd be very convenient if bugzilla didn't claim
"incorrect captcha" when the problem is "i can't set a cookie")


Previous Comments:
------------------------------------------------------------------------
[2005-02-21 23:55:17] scooley at apple dot com

Description:
------------
why not some behavior like this?



...

switch($var)

        {

        case <= 9:

                {

                echo "less than ten";

                break;

                }

        case 10:

                {

                echo "ten exactly";

                break;

                }

        case >10 <> <15:

                {

                echo “a range of values? why not?";

                break;

                }

        case >= 15:

                {

                echo “greater than or equal to fifteen";

                break;

                }

        default:

                {

                echo “what am I not thinking of here?”

                break;

                }

        }

…



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=32059&edit=1

Reply via email to