Created
April 3, 2014 15:59
-
-
Save 2803media/9957218 to your computer and use it in GitHub Desktop.
Remove doublon from a text, first break by '.' then by ',' and after build a text without doublons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $content = ""; | |
| $content = preg_replace('/\n\r|\r\n|\n|\r/','', $content); | |
| $content = preg_replace('/\s+/', ' ',$content); | |
| $content = preg_replace('/<br \/><br\/><br\/><br\/> /',' ', $content); | |
| $content = str_replace(' ','',$content); | |
| $content = str_replace(''','\'',$content); | |
| $content = str_replace('à','à',$content); | |
| $content = str_replace('é','é',$content); | |
| $content = preg_replace('/\n\r|\r\n|\n|\r/','', $content); | |
| $parts = explode('.',$content); | |
| $sentences = array(); | |
| $sentences2 = array(); | |
| $sentences = array_values(array_unique($parts)); | |
| foreach($sentences as $sentence){ | |
| $parts2[] = explode(',',$sentence); | |
| } | |
| foreach($parts2 as $parts21){ | |
| foreach($parts21 as $parts211){ | |
| $sentences2[] = $parts211; | |
| } | |
| } | |
| $sentences2 = array_values(array_unique($sentences2)); | |
| foreach($sentences2 as $sentences21){ | |
| echo $sentences21; | |
| echo '. '; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment