RE: [PHP] String replacement
| From: | Adam Charnock | Date: | Mon, 07 Aug 2000 11:28:40 +0000 |
| Subject: | RE: [PHP] String replacement | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-10453@lists.php.net to get a copy of this message | ||
Couldn't you just use the XML functions in PHP for this? Ive never tried using them, but its just a thought.
Adam
PS. Does anyone know if the XML functions are supplied with PHP4?
At 02:29 06-08-00 +0100, you wrote:
For example: Original string = "This is a string. <CAP>This part should be capitalized.</CAP>" [...] New string = "This is a string. THIS PART SHOULD BE CAPITALIZED." preg_match('/<CAP>(.+)<\/CAP>/U', $orig_string, $matches); $new_string = str_replace('<CAP>'.$matches[1].'</CAP>', strtoupper($matches[1]), $orig_string); -- Richard Heyes http://www.heyes-computing.net/scripts/ Plain text email only please! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net