note 95696 deleted from function.preg-replace by danbrown
| From: | danbrown@php.net | Date: | Sat, 16 Jan 2010 18:33:28 +0000 |
| Subject: | note 95696 deleted from function.preg-replace by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-165030@lists.php.net to get a copy of this message | ||
Note Submitter: alex14xp at gmail dot com
----
I have a simpler version of the word_replace() function:
<?php
/*
Author: Alejandro of sortea2.com
(string) $search: word to search
(string) $replace: word to replace
(string) $subject: string with the word to replace
*/
function word_replace($search, $replace, $subject) {
return preg_replace('/\b('.$search.')\b/', $replace, $subject);
}
?>