1

i am using something like the following but the function replace_callback isnt executed at all

$body2 = preg_replace_callback("/\{(.*)\}/isUe","replace_callback",$body);

the string $body looks like this:

...<Cell><Data>{var}</Data></Cell>...

where is my fault

doesnt work:

function replace_callback() {
$test999= "asdasdasdasdasdasdsdd";
return($test999);
}

$body2 = preg_replace_callback("/\{(.*)\}/isU","replace_callback",$body);
Martin Huwa
  • 401
  • 3
  • 7
  • 11

1 Answers1

0

Don't use the e (eval) modifier with preg_replace_callback.

BTW PHP displays a warning if you try to do it; don't hide them.

Arnaud Le Blanc
  • 98,321
  • 23
  • 206
  • 194
  • well function replace_callback() { $test999= "asdasdasdasdasdasdsdd"; return($test999); } echo $body; $body2 = preg_replace_callback("/\{(.*)\}/isU","replace_callback",$body); doesnt work – Martin Huwa Sep 16 '11 at 14:30
  • i tried to show all errors / warnings but php doesnt show me any error / warning – Martin Huwa Sep 16 '11 at 14:32
  • i want to attach $body2 to another var so $body .= $body2; echo $body; doesnt work, my code looks like this: $body_final .= "$body2\n"; – Martin Huwa Sep 16 '11 at 14:41