problem with a function
Posted: Wed Jun 07, 2006 10:11 am
i have the function coloreaza_cuvant_gasitthat find and replace the word $cuvant with $cuvant_inlocuitor. But if in my page the word is writed with the first letter uppercase, then , str_replace function don't repalce the word. I have to use $rezultat=str_replace(ucfirst($cuvant_cautat),$cuvant_inlocuitor,$buffer); , but i don't know where to place it in the function...can u help me?
thanks
function coloreaza_cuvant_gasit($buffer){
global $cuvant_cautat;
global $cuvant_inlocuitor;
$rezultat=str_replace($cuvant_cautat,$cuvant_inlocuitor,$buffer);
return $rezultat;
}
ob_start("coloreaza_cuvant_gasit");
include("mypage.ro");
ob_end_flush();
thanks
function coloreaza_cuvant_gasit($buffer){
global $cuvant_cautat;
global $cuvant_inlocuitor;
$rezultat=str_replace($cuvant_cautat,$cuvant_inlocuitor,$buffer);
return $rezultat;
}
ob_start("coloreaza_cuvant_gasit");
include("mypage.ro");
ob_end_flush();