At 12/9/2002 07:20 PM, you wrote:

It'd be easier to use a regular expression for something like this.
Something like this would work (from PHP Architect):

$s = "I am going to be {a} years old on the {b}th of November, {c}.";
$a = array(
"a" => "one hundred",
"b" => "seventeen",
"c" => "two thousand two");
$z = preg_replace("/\{([a-z]+)\}/e","\$a['$1']",$s);
echo $z;
I am going to be one hundred years old on the seventeenth of November,
two thousand two.
Now that I've been shown what you meant, and had a chance to play with it, I can see that it's not really going to work out for me. The reason is, I don't know in advance what the contents of the [] will be.
S. Keller
UI Engineer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Pkwy.
Anchorage, AK 99508
907.770.6200 ext.220
907.336.6205 (fax)

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to