diff --git a/phpdotnet/phd/Highlighter.php b/phpdotnet/phd/Highlighter.php index db82b555..84817728 100644 --- a/phpdotnet/phd/Highlighter.php +++ b/phpdotnet/phd/Highlighter.php @@ -63,10 +63,15 @@ public function highlight($text, $role, $format) if ($role == 'php') { try { - return strtr(highlight_string($text, 1), [ - ' ' => ' ', - "\n" => '', - ]); + $highlight = highlight_string($text, true); + if (PHP_VERSION_ID >= 80300) { + return $highlight; + } else { + return strtr($highlight, [ + ' ' => ' ', + "\n" => '', + ]); + } } catch (\ParseException $e) { v("Parse error while highlighting PHP code: %s\nText: %s", (string) $e, $text, E_USER_WARNING);