note 77440 added to function.ereg-replace
| From: | mbotta78athotmaildotcom at osu1 dot php dot net | Date: | Wed, 29 Aug 2007 21:26:17 +0000 |
| Subject: | note 77440 added to function.ereg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129888@lists.php.net to get a copy of this message | ||
is it posible to apply user defined function to replacement?
as sample this works for me:
echo ereg_replace('#([0-9]+)#', '<b>\\1<b>' ,
'string_received44');
but i would like to do something like:
echo ereg_replace('#([0-9]+)#', my_function('\\1') ,
'string_received44');
function my_function($input){
// this is just sample code,
// this function could be more complex
return 2 * $input;
}
----
Server IP: 69.147.83.197
Probable Submitter: 190.30.67.45
----
Manual Page -- http://www.php.net/manual/en/function.ereg-replace.php
Edit -- https://master.php.net/note/edit/77440
Del: integrated -- https://master.php.net/note/delete/77440/integrated
Del: useless -- https://master.php.net/note/delete/77440/useless
Del: bad code -- https://master.php.net/note/delete/77440/bad+code
Del: spam -- https://master.php.net/note/delete/77440/spam
Del: non-english -- https://master.php.net/note/delete/77440/non-english
Del: in docs -- https://master.php.net/note/delete/77440/in+docs
Del: other reasons-- https://master.php.net/note/delete/77440
Reject -- https://master.php.net/note/reject/77440
Search -- https://master.php.net/manage/user-notes.php