<?php
$text = file_get_contents("text.txt");
$text = rtrim(preg_replace("/[rn]+/m","rn",$text));
echo (file_put_contents('text.txt',$text))?"OK": "FAIL";
?>
<?php
$text = file_get_contents("text.txt");
$text = rtrim(preg_replace("/[rn]+/m","rn",$text));
echo (file_put_contents('text.txt',$text))?"OK": "FAIL";
?>