Are there any specific PHP functions or methods that can help with efficiently manipulating the contents of a text file when writing to the beginning?

When writing to the beginning of a text file in PHP, one efficient way to manipulate the contents is by using the `file_get_contents()` function to read the existing content, then prepend the new content to it, and finally write the combined content back to the file using the `file_put_contents()` function.

// Read existing content from the file
$existingContent = file_get_contents('example.txt');

// Prepend new content to the existing content
$newContent = "New content to be added\n" . $existingContent;

// Write the combined content back to the file
file_put_contents('example.txt', $newContent);