How can a beginner approach writing a PHP script to display data from a file on an HTML page?

To display data from a file on an HTML page using PHP, a beginner can start by reading the contents of the file using functions like `file_get_contents()` or `fopen()`. Then, they can use PHP to format the data and echo it within the HTML structure to display it on the webpage.

<?php
$file = 'data.txt';
$data = file_get_contents($file);

echo "<html>";
echo "<head><title>Data Display</title></head>";
echo "<body>";
echo "<h1>Data from file:</h1>";
echo "<p>$data</p>";
echo "</body>";
echo "</html>";
?>