oskare100 Posted December 26, 2007 Share Posted December 26, 2007 Hello, This is the code snippet: $breadcrumbtrail = $breadcrumb->trail(' » '); $breadcrumbexploded = explode(";", $breadcrumbtrail); echo $breadcrumbexploded[0]; if ($breadcrumbexploded[0] == "&RAQUO") { echo "true"; } else { echo "false"; } 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 Quote Link to comment https://forums.phpfreaks.com/topic/83258-problem-with-if-statement-that-should-return-true/ Share on other sites More sharing options...
PHP_PhREEEk Posted December 26, 2007 Share Posted December 26, 2007 What does this say? <?php $breadcrumbtrail = $breadcrumb->trail(' » '); $breadcrumbexploded = explode(";", $breadcrumbtrail); var_dump($breadcrumbexploded[0]); if ($breadcrumbexploded[0] == "&RAQUO") { echo "true"; } else { echo "false"; } PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/83258-problem-with-if-statement-that-should-return-true/#findComment-423544 Share on other sites More sharing options...
cooldude832 Posted December 26, 2007 Share Posted December 26, 2007 you use two things you don't define the function trail and the variable $breadcrumb explain those and we can see why also try print_r($breadcrumbexploded); to see the array's content Quote Link to comment https://forums.phpfreaks.com/topic/83258-problem-with-if-statement-that-should-return-true/#findComment-423546 Share on other sites More sharing options...
czukoman20 Posted December 26, 2007 Share Posted December 26, 2007 if ($breadcrumbexploded[0] == "&RAQUO") { why is $raque in the beginning lowercase ... then in the if capitalized... try making then the same Quote Link to comment https://forums.phpfreaks.com/topic/83258-problem-with-if-statement-that-should-return-true/#findComment-423562 Share on other sites More sharing options...
cooldude832 Posted December 26, 2007 Share Posted December 26, 2007 its not $ its & and &RAQUO is the proper xhtml way to display a < symbol so maybe you could do <?php $str = strreplace("&RAQUO;","<",$string); $parts = explode("<",$str); if($parts[0] != ""){ //Do something } ?> Quote Link to comment https://forums.phpfreaks.com/topic/83258-problem-with-if-statement-that-should-return-true/#findComment-423566 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.