How can PHP be used to retrieve and display the source code of a specific webpage?

To retrieve and display the source code of a specific webpage using PHP, you can use the file_get_contents() function to fetch the HTML content of the webpage and then simply echo out the content to display it on the screen.

<?php
$url = 'https://www.example.com'; // specify the URL of the webpage
$html = file_get_contents($url); // fetch the HTML content of the webpage
echo $html; // display the HTML content on the screen
?>