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? Link to comment https://forums.phpfreaks.com/topic/159927-solved-array-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.