skenny Posted July 4, 2009 Share Posted July 4, 2009 Ok I have a code but there are some things i need to add to it but i don't know what Here is what i want to do 1.Remove Duplicates from the array 2.Remove Items from the array that have the word "directory" in it Here is the code preg_match_all($pattern, $contents, $results, PREG_PATTERN_ORDER); $results = $results[1]; $results = implode("SPLIT",$results); $results = "SPLIT".$results; $results = str_replace("SPLIT/","SPLIT"."/",$results); $results = explode("SPLIT", $results); array_shift($results); foreach ($results as $t ) { print ('<a href="'. $t .'">' . $t . '</a><br>'); } It doesn't have to remove the duplicates or the items with the word "directory" I just don't want these items to PRINT Any help is greatly appreciated Quote Link to comment https://forums.phpfreaks.com/topic/164726-need-help-on-preg-match/ Share on other sites More sharing options...
The Eagle Posted July 4, 2009 Share Posted July 4, 2009 Your indentation is incorrect. You may want to start by fixing your match_all strip tags. Also, foreach ($results as $t ) { Possibly needs a ; Quote Link to comment https://forums.phpfreaks.com/topic/164726-need-help-on-preg-match/#findComment-868643 Share on other sites More sharing options...
.josh Posted July 4, 2009 Share Posted July 4, 2009 As far as #1, you can use array_unique Quote Link to comment https://forums.phpfreaks.com/topic/164726-need-help-on-preg-match/#findComment-868672 Share on other sites More sharing options...
skenny Posted July 5, 2009 Author Share Posted July 5, 2009 As far as #1, you can use array_unique cool thanks to both of you guys. Ummm I am a complete newbie to PHP could anyone possibly help me with the coding of array_unique? I want anything with the word "directory" to not be added to the array OR to not be printed Quote Link to comment https://forums.phpfreaks.com/topic/164726-need-help-on-preg-match/#findComment-869044 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.