Display the drop-down list

preg_replace_callback()

« preg_replace | preg_split »
<?php
// custom callback functions
function to_lower($matches)  { return strtolower($matches[0]); };
function 
next_year($matches) { return $matches[1] . ($matches[2] + 1); };

$mixed preg_replace_callback (
    
// mixed $pattern
    
?// callable $callback
    
// mixed $subject
    
// [int $limit = -1]
    
  // [int &$count]
);
?>
Result
$mixed = '<p>there is an elephant</p>'
Examples
#1 preg_replace_callback  ('|<p>\s*\w|',
 
"to_lower",
 
"<p>There is an elephant</p>")
#2 preg_replace_callback  ('|(\d{2}/\d{2}/)(\d{4})|',
 
"next_year",
 
"April fools day is 04/01/2002 Last christmas was 12/24/2001 ")
See also
call_user_func, preg_last_error, preg_quote, preg_replace, strtolower