What PHP function can be used to highlight and display the source code of a webpage on another webpage?
To highlight and display the source code of a webpage on another webpage, you can use the `highlight_string()` function in PHP. This function takes a string of PHP code as input and outputs it with syntax highlighting.
<?php
$url = 'http://example.com'; // URL of the webpage whose source code you want to display
$html = file_get_contents($url); // Get the HTML source code of the webpage
highlight_string($html); // Display the highlighted source code on the webpage
?>
Keywords
Related Questions
- What are the best practices for uninstalling PHP 5 before installing PHP 7 to avoid any conflicts or issues?
- How can incorrect path definitions in PHP includes lead to errors like "failed to open stream: No such file or directory"?
- What are the best practices for creating dependent drop-down menus in PHP?