note 102424 added to function.preg-replace

[email protected] Sun, 13 Feb 2011 15:29:40 -0800
Newsgroups php.notes
Message-ID <[email protected]>
useful function:
function preg_replace_assoc($assoc, $subject) {
  return preg_replace(array_keys($assoc), array_values($assoc), $subject);
}

example:
$terms = array(
  '/cat/' => 'dog',
  '/meow/' => 'bark'
);

preg_replace_assoc($terms, 'The cat goes "meow".'); //The dog goes "bark".
----
Server IP: 192.41.42.26
Probable Submitter: 108.12.161.155
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit        -- https://master.php.net/note/edit/102424
Del: integrated  -- https://master.php.net/note/delete/102424/integrated
Del: useless     -- https://master.php.net/note/delete/102424/useless
Del: bad code    -- https://master.php.net/note/delete/102424/bad+code
Del: spam        -- https://master.php.net/note/delete/102424/spam
Del: non-english -- https://master.php.net/note/delete/102424/non-english
Del: in docs     -- https://master.php.net/note/delete/102424/in+docs
Del: other reasons-- https://master.php.net/note/delete/102424
Reject      -- https://master.php.net/note/reject/102424
Search      -- https://master.php.net/manage/user-notes.php