dennismonsewicz Posted May 27, 2009 Share Posted May 27, 2009 I have this code: <?php $url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; $find = false; $aryCarriers = array('cat', 'dog'); foreach($aryCarriers as $carrier) { if(strpos($url, $carrier)) { $find = "http://localhost/web/pcc/" . $carrier; } else { $find = "ERROR"; } } echo $find; ?> If dog is the last string in the array and is in the url (http://localhost/web/pcc/dog/page.php) everything works fine! But if dog is anywhere else in the array it does not work. Any suggestions on this? Quote Link to comment 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.