cursed Posted August 16, 2009 Share Posted August 16, 2009 Hey, just a quick question about why this script doesn't work: <? $ref = strtoupper($_SERVER['HTTP_REFERER']); if (strpos($ref,"EXAMPLE1") || (strpos($ref,"EXAMPLE2")) { echo "you're from ex"; } else { echo "you're not from ex"; } ?> On this line, if (strpos($ref,"EXAMPLE1")) { if I remove || (strpos($ref,"EXAMPLE2"), it works fine. However, when I add that, I get Parse error: syntax error, unexpected '{' Thanks in advance for your help. Link to comment https://forums.phpfreaks.com/topic/170545-solved-quick-newbie-question-about-or/ Share on other sites More sharing options...
smerny Posted August 16, 2009 Share Posted August 16, 2009 || (strpos($ref,"EXAMPLE2")) { change to || strpos($ref,"EXAMPLE2")) { Link to comment https://forums.phpfreaks.com/topic/170545-solved-quick-newbie-question-about-or/#findComment-899593 Share on other sites More sharing options...
cursed Posted August 16, 2009 Author Share Posted August 16, 2009 Thank you very much. Link to comment https://forums.phpfreaks.com/topic/170545-solved-quick-newbie-question-about-or/#findComment-899594 Share on other sites More sharing options...
smerny Posted August 16, 2009 Share Posted August 16, 2009 in case you're not sure why that error existed... the parenthesis are color coded to show where they match up with if (strpos($ref,"EXAMPLE1") || (strpos($ref,"EXAMPLE2")) { notice there is no end parenthesis on the red one, which makes it think it's still in the if statement, and does not expect the { rather than add one at the end, i just removed the unnecessary one Link to comment https://forums.phpfreaks.com/topic/170545-solved-quick-newbie-question-about-or/#findComment-899596 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.