$line) { if (strpos($line, '$translations = [') === 0) { $start = $i; } if (strpos($line, 'function t(') === 0) { $end = $i; break; } } if ($start !== -1 && $end !== -1) { $new_content = array_slice($lines, 0, $start); $new_content[] = file_get_contents('new_trans.txt'); $new_content = array_merge($new_content, array_slice($lines, $end)); file_put_contents('includes/app.php', implode("", $new_content)); echo "Replaced lines $start to $end\n"; } else { echo "Could not find start/end\n"; } ?>