www.webdeveloper.com
Results 1 to 5 of 5

Thread: Similar string not matched?

  1. #1
    Join Date
    Sep 2006
    Posts
    655

    Question Similar string not matched?

    Hi

    Can someone please explain why it prints 2?

    Code:
    <?php
    if ('EMAIL' == 'EMAIL'){
    print "1";
    }else{
    print "2";
    }
    ?>



    Thanks

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,322
    Works fine for me:
    Code:
    C:\Windows\Temp>php -r "if('EMAIL' == 'EMAIL') { print '1';} else {print '2';}"
    1
    C:\Windows\Temp>
    Are you sure that's the exact code you are testing?
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Sep 2006
    Posts
    655
    That IS the actual thing, and I posted it here because I could not find any reason why it would not match. I mean both are simple strings. If you copy/paste my above code and try it on ur end, it will not work.

    I just wanna know the reason.


    Thanks

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,322
    You have some sort of non-printing character right before the "E" of the first "EMAIL" (between the quote and the "E").
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  5. #5
    Join Date
    Sep 2006
    Posts
    655
    Thanks fro your kind help

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles