[PHP] ereg_replace with unser defined function?

2006-10-09 Thread Frank Arensmeier
Hello all. Is it possible to have a user defined function for the replacement within an ereg_replace (like preg_replace_callback)? I am working on a script that converts html pages with metric data into imperial data. My script takes text strings containing one or more instances of e.g.

Re: [PHP] ereg_replace with unser defined function?

2006-10-09 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-10-09 09:46:01 +0200: Is it possible to have a user defined function for the replacement within an ereg_replace (like preg_replace_callback)? I am working on a script that converts html pages with metric data into imperial data. My script takes text strings

Re: [PHP] ereg_replace with unser defined function?

2006-10-09 Thread Ilaria De Marinis
Hi Frank, I think preg_replace_callback is a good solution for you. If you don't want to use it, you can construct two arrays defining matches and replacements. For example: $matches [230] [120] [340] $replacements [9.1] [replace2] [replace3] After you stored matches in $matches using