What is the purpose of the highlight_string() function in PHP?
The highlight_string() function in PHP is used to syntax highlight a string using colors to make it more readable. This can be useful when displaying code snippets on a website or in a text editor. It helps to differentiate between different parts of the code such as keywords, strings, comments, etc.
<?php
$code = '<?php echo "Hello, World!"; ?>';
highlight_string($code);
?>
Related Questions
- What alternative methods or tools can be used to sanitize and display PHP code in a forum to prevent security vulnerabilities?
- What are the best practices for organizing PHP files and directories to prevent unauthorized access?
- What are the potential pitfalls of using multiple queries in a single statement in PHP?