Falls mal einer die Zeilen eines Textes umdrehen möchte:
//source file
$source = "konzerte.txt";
//put the lines of the files in the lines-array
$lines = file($source);
//reverse the lines-array
$lines = array_reverse($lines);
//put the elements of the reversed array together
foreach ($lines as $element) {
$text .= $element;
}
//output file
$output = "bla.txt";
//open the output file and create it if it doesn't exist
$handler = fOpen($output, "a+");
//write the file
fWrite($handler , $text);
Vorher:
la
le
lu
Nachher:
lu
le
la
Download: text_reverse.php