preg_replace_callback

Example

 mixed preg_replace_callback ( mixed $pattern , callback $callback , mixed $subject [, int $limit = -1 [, int &$count ]] ) 

Description

The behavior of this function is almost identical to preg_replace(), except for the fact that instead of replacement parameter, one should specify a callback.

Return Values

preg_replace_callback() returns an array if the subject parameter is an array, or a string otherwise. On errors the return value is NULL If matches are found, the new subject will be returned, otherwise subject will be returned unchanged.