How can PHP be used to manipulate a text file to extract only a certain number of characters?

To extract only a certain number of characters from a text file using PHP, you can read the contents of the file into a variable and then use the `substr()` function to extract the desired number of characters. You can then output or manipulate these extracted characters as needed.

<?php
// Read the contents of the text file into a variable
$text = file_get_contents('example.txt');

// Extract only the first 100 characters from the text
$extracted_text = substr($text, 0, 100);

// Output the extracted text
echo $extracted_text;
?>