<? // the phpcode you want to highlight $code = "<?\n"; $code .= "echo \"test\";\n"; $code .= "?>"; highlight_string($code); // highlights the string ?>