How can the highlight_string() function be effectively integrated into PHP code for syntax highlighting purposes?

To integrate the highlight_string() function into PHP code for syntax highlighting, you can pass the code snippet you want to highlight as a string to the function. This function will then return the highlighted version of the code with HTML markup for syntax highlighting.

<?php
$code = '<?php echo "Hello, World!"; ?>';
highlight_string($code);
?>