We'll try something...
$file = "myfile.html";
$fp = fopen($file, "r");
$file_content = fread($fp, filesize($file));
fclose($file_content);
$file_content_tolower = strtolower($file_content);
$start_tag = "<coding>";
$end_tag = "</coding>";
$start_tag = strtolower($start_tag);
$end_tag = strtolower($end_tag);
$start_pos = strpos($file_content_tolower, $start_tag);
$end_pos = strpos($file_content_tolower, $end_tag);
if($start_pos === false || $end_pos === false) {
// <coding> and/or </conding> were not found
echo "HTML file is not valid !\n";
} else {
// both <coding> and </coding> were found
$start_pos = $start_pos + strlen($start_tag);
$beginning_of_file = substr($file_content, 0, $start_pos);
$end_of_file = substr($file_content, $end_pos);
$new_coding_content = "--- THE NEW TEXT TO INSERT BETWEEN <coding> and </coding> ---";
$new_file_content = $beginning_of_file . $new_coding_content . $end_of_file;
$fp = fopen($file, "w");
fputs($fp, $new_coding_content);
fclose($fp);
Hope it helps !
}