SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Location
    Israel
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    special chars in a "switch and case" section.

    well the thing is this,
    this is the code:

    //$char is the character itself and NOT its ascii value.

    switch ($char)
    {
    case "!":
    .
    .
    .
    break;
    case "@":
    .
    .
    .
    break;
    }
    this is fine and works, but what do i need to do when i need the case to be of a $ sign or a \ sign or a " sign?
    any one???
    You can't see your self in the mirror with your eyes closed!

  2. #2
    Custom User Title v1.0 FireFly's Avatar
    Join Date
    Aug 2001
    Posts
    363
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    switch ($char) {
        case 
    '!':
            .
            .
            .
            break;
        case 
    '@':
            .
            .
            .
            break;
        case 
    '$':
            .
            .
            .
            break;
        case 
    '\\\\\\':
            .
            .
            .
            break;
        case 
    '"':
            .
            .
            .
            break;

    Note I am using single quotes (') instead of double quotes (") so I don't need to escape $ nor " there. You still must escape \ though.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Location
    Israel
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok thnx i will try it
    ודרך אגב, טוב לראות אותנו גם כאן כמה קטנים ככה גדולים תודה.
    You can't see your self in the mirror with your eyes closed!

  4. #4
    Custom User Title v1.0 FireFly's Avatar
    Join Date
    Aug 2001
    Posts
    363
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No problems.

    בהחלט טוב לראות אותנו כאן!
    Last edited by FireFly; Feb 1, 2002 at 11:03.

  5. #5
    SitePoint Wizard dragonfly_7456's Avatar
    Join Date
    Dec 2002
    Location
    Moscow, USSR
    Posts
    1,092
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Хуй вам всем тоже
    Content Writing Service - Get custom SEO articles for 10$


Bookmarks

Posting Permissions

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