i have a text file say "list.text" containing phrase that is words and spaces, each phrase is in a new line.
I have a large number of text files in the form of paragraphs of size app 2mb each,i need to find the phrases existing in the list.text in every file and replace them with phrases having _ in place of spaces.
my code below shows error i cannot comprehend something related to memory.PLZ help
I have a large number of text files in the form of paragraphs of size app 2mb each,i need to find the phrases existing in the list.text in every file and replace them with phrases having _ in place of spaces.
my code below shows error i cannot comprehend something related to memory.PLZ help
Code:
$m=file_get_contents ('sample.txt'); $comp=file('list.txt'); for ($x=0; $x<= count($comp); $x++) { $comp[$x] = trim(strtolower($comp[$x])); $c =$comp[$x]; $rep=str_replace(" ","_",$c); $rep=" ".$rep." "; $m =preg_replace($c,$rep,$m); }
Comment