katlis Posted November 2, 2008 Share Posted November 2, 2008 Hello, I have an array, $results, that contains a variety of links... ie: ("http://blah.com/hey/","http://www.sweet.com/yo/","/somedir/","http://nope.com/whatever","/yah/") How can I remove all of the values EXCEPT the ones that contain either: - http://blah.com - http://www.blah.com - or the ones that are just directories (no http/https/ftp) I appreciate any help. Link to comment https://forums.phpfreaks.com/topic/131054-deleting-values-from-an-array-if/ Share on other sites More sharing options...
ratcateme Posted November 2, 2008 Share Posted November 2, 2008 try $new_results = array(); foreach($results as $url){ if($url[0] != "/"){ $new_results[] = $url; } } Scott. Link to comment https://forums.phpfreaks.com/topic/131054-deleting-values-from-an-array-if/#findComment-680419 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.