<?php $for_edit = "подробнее"; // искомая строка 1 $for_edit2 = "подробнее2"; // искомая строка 2 $what = "кратко"; // на эту меняем $fopen = @file("21.txt"); foreach ($fopen as $key => $value) { if (substr_count($value, $for_edit)) { if (isset($fopen[$key + 1])) { array_splice($fopen, $key + 1, 1, $what); } } $f = fopen("21.txt", "w"); for ($i = 0; $i < count($fopen); $i++) { fwrite($f, $fopen[$i]); } fclose($f); } ?> The script searches for a specific string and changes the next one to the right one, how to make the script search 2 specific lines and everything between them, change it to the necessary string? (Even it is impossible to format the text.)