Results 1 to 4 of 4

Thread: Switch

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Switch

    Is a switch statement done in PHP just as it is in C++?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  2. #2

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Yes, it is:

    PHP Code:
    switch ($i) {
        case 
    0:
            print 
    "i equals 0";
            break;
        case 
    1:
            print 
    "i equals 1";
            break;
        case 
    2:
            print 
    "i equals 2";
            break;

    Thanks!
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3
    No problem!

    Remember there's default too

  4. #4

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    You betcha
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width