Debt Help | Debt Help | Articles directory | Submit articles | Breast Enlargement
Code Hilite Function [Archive] - Muslim Programmers & Designers Community - Islamic Webhosting and Nasheeds

PDA

View Full Version : Code Hilite Function



WiseOne
05-27-2003, 07:13 PM
Hi guys heres this function some php programmer made this will highlight all code between and . He made it for articles and tutorials where collaborators post their stuff and need some code into it. Hope its useful to you



<?
function color_source($string){
$array_contenido = explode("",$string);
$final = $array_contenido[0];
for($i = 1;$i <= count($array_contenido);$i++){
$array_contents = explode("",$array_contenido[$i]);
ob_start();
highlight_string($array_contents[0]);
$array_contents[0] = ob_get_contents();
ob_end_clean();
$final .='
<font face="Courier new, Courier, Mono" size=3>'.$array_contents[0]."</font>
".$array_contents[1];
}
return $final;
}
?>
Credit : solophp