I have this script
<?php
$text1 = "english words";
$text = explode(" ", $text1);
$english = array_map('trim', file('./langs/english.lng'));
$french = array_map('trim', file('./langs/french.lng'));
$text = str_replace($english, $french, $text);
$output = implode(" ", $text);
echo $output;
?>
Basically it is supposed to find all of the words in $text that correspond to english.lng and replace them with words from french.lng however i need it to only process words from $text once therefore the word therefore would be translated once as therefore not two seperate words there and for with extra characters lurking around.