What function can be used in PHP to read the contents of an external text file and display it on a webpage?

To read the contents of an external text file and display it on a webpage in PHP, you can use the `file_get_contents()` function. This function reads the entire contents of a file into a string. You can then echo or print this string to display the file's contents on the webpage.

<?php
$file = 'example.txt'; // specify the path to the text file
$content = file_get_contents($file); // read the contents of the file into a string
echo $content; // display the contents on the webpage
?>