Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/06/2009, 10:05
Avatar de Kenichi
Kenichi
 
Fecha de Ingreso: enero-2009
Ubicación: Rosario, Argentina
Mensajes: 160
Antigüedad: 16 años, 1 mes
Puntos: 6
Usar preg_replace() con una funcion

Buenas comunidad, de nuevo tengo otro problema con lo del bbcode xD, mi pregunta es: Se puede usar bbcode reemplazando un texto por una funcion que usa ese texto? Es decir, lo que quiero hacer es esto:
Código PHP:
<?php
function resaltarphp($texto)
{
   
$texto html_entity_decode($texto); // Saco el htmlentities que use antes
   
$texto highlight_string($texto); // Doy el highlight
   
return $texto// Devuelvo el codigo resaltado
}
function 
bbcode($texto)
{
   
$texto htmlentities($texto);
   
$texto preg_replace("/\[php\](.*?)\[\/php\]/is","<fieldset class=\'php\'><legend>Codigo PHP: </legend>".resaltarphp($1)."</fieldset>"$texto);
  return 
$texto;
}
?>
Pero cuando uso esa funcion, me este parse error:
Cita:
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in C:\wamp\www\foro desde 0\foro\editor\funciones.php on line 56
Les agradeceria mucho su ayuda
Saludos