Problem with if statement that should return true

Discussion in 'PHP' started by oskare100, Dec 26, 2007.

  1. #1
    Hello,
    This is the code snippet:

    $breadcrumbtrail = $breadcrumb->trail(' » ');
    $breadcrumbexploded = explode(";", $breadcrumbtrail);
    echo $breadcrumbexploded[0];
    if ($breadcrumbexploded[0] == "&RAQUO") {
    echo "true";
    } else {
    echo "false";
    }
    Code (markup):
    That code returns the text "&RAQUOfalse" but it should return "&RAQUOtrue" since $breadcrumbexploded[0] == "&RAQUO". I can't figure out why it can't understand that $breadcrumbexploded[0] actuallt is &RAQUO.

    Best Regards
    Oskar R
     
    oskare100, Dec 26, 2007 IP
  2. faceless

    faceless Peon

    Messages:
    34
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I wonder why "&RAQUO" is in uppercase letters since it is in lowercase ones in the first line? But it seems that there is white space at the beginning of $breadcrumbexploded[0], so try:

    if (ltrim($breadcrumbexploded[0]) == "&RAQUO") {
    Code (markup):
     
    faceless, Dec 26, 2007 IP