How can PHP code be displayed in color on a website?

To display PHP code in color on a website, you can use syntax highlighting. This can be achieved by wrapping the PHP code in <pre> tags and applying a CSS class that styles the code with different colors for keywords, variables, and comments. There are also libraries and plugins available that can automatically highlight code for you. ```html <!DOCTYPE html> <html> <head> <title>PHP Code Highlighting</title> <style> .code { color: #333; font-family: monospace; } .keyword { color: blue; } .variable { color: green; } .comment { color: grey; } </style> </head> <body> <pre class="code"> <?php // PHP code to be highlighted $variable = "Hello, World!"; echo $variable; ?> </pre> </body> </html> ```