How can PHP code be highlighted and replaced within specific tags?
To highlight and replace PHP code within specific tags, you can use a combination of HTML `<pre>` tags for preserving whitespace and the `htmlspecialchars()` function to escape special characters in the PHP code. This will ensure that the PHP code is displayed correctly without being executed.
<?php
$phpCode = '<?php echo "Hello, World!"; ?>';
$highlightedCode = '<pre>' . htmlspecialchars($phpCode) . '</pre>';
echo $highlightedCode;
?>