preg_replace Question
| From: | Richard Luckhurst | Date: | Fri, 04 Apr 2008 04:04:07 +0000 |
| Subject: | preg_replace Question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-272512@lists.php.net to get a copy of this message | ||
Hi List
I am trying to perform a number of replacements of place holders in an html page
I am working on using preg_replace. I am stuck with a pronlem I can not work out
and would appreciate some help.
The code I have is as follows
$html = preg_replace('/%Amount/',$amount,$html);
$html is the source of a html page
$amount is set earlier to a value read from a file
When I view the html page the value of %Amount is not what I would expect.
e.g $amount = $524.00 however only 4.00 is displayed in the %Amount field on the
html page. I tried dropping the .00 from $amount to see if this might be a
length issue and then %Amount was just 4
Am I doing something obviously wrong here? I have checked the php manual and I
appear to be using preg_replace correctly.
Regards,
Richard Luckhurst
Product Development
Exodus Systems - Sydney, Australia.
rluckhurst@resmaster.com
Tel: (+612) 4751-9633
Fax: (+612) 4751-9644
Web: www.resmaster.com
=================================================
Exodus Systems - Smarter Systems, Better Business
=================================================