Error using preg_replace_callback()
Hi ,
I am trying to echo a variable that contains Html data. I want the the
html tags to be interpreted the way they are.
I am able to get the expected output using preg_replace_callback()
and evalInlinePHP function. But at the same time I get a warning as
mentioned below:
Warning (2): preg_replace_callback() [function.preg-replace-callback]:
Requires argument 2, 'evalInlinePHP', to be a valid callback
Code
<?php echo h($product['Product']['features']);
$test = $product['Product']['features'];
echo preg_replace_callback('|<p>\s*\w|','evalInlinePHP',$test);
?>
public function evalInlinePHP($m)
{
ob_start();
eval($m[1]);
return ob_get_clean();
}
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home