Código PHP:
function funcionUper($text){
$text = strtoupper($text);
return $text;
}
///////
function bbCode($texto){
// Funciona
$texto = preg_replace("/\\[b\\](.+?)\[\/b\]/is",'<b>\1</b>', $text);
// y Eso es lo que no funciona, es decir no toma a funcionUper como una función
$texto = preg_replace("/\\[CLAVE\\](.+?)\[\/CLAVE\]/is",funcionUper('\1'), $text);
return $texto;
}
Código PHP:
//...
$clave = preg_match("/\\[CLAVE\\](.+?)\[\/CLAVE\]", $text);
if($clave ){
$nuevo = preg_replace("/\(\((.+?)\)\)/is",'\1', $text);
$texto = funcionUper($nuevo);
}
return $texto;
La idea es reemplazar todos los textos que contengan [CLAVE]unaclave[/CLAVE] por la clave en mayúsculas.