RE: [PHP] replacing first occurence
| From: | Maxim Maletsky \(PHPBeginner.com\) | Date: | Wed, 24 Apr 2002 16:30:30 +0000 |
| Subject: | RE: [PHP] replacing first occurence | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-94416@lists.php.net to get a copy of this message | ||
Two ways:
1. $string = preg_replace("^.{1}", 'h', 'bill'); // will make
'h'ill out of 'b'ill
2. $string = 'h'.substr('bill', 1); // will
get rid of the first char and concatenate
Sincerely,
Maxim Maletsky
Founder, Chief Developer
www.PHPBeginner.com // where PHP Begins
-----Original Message-----
From: Diana Castillo [mailto:diana.castillo@nvtechnologies.com]
Sent: Wednesday, April 24, 2002 6:09 PM
To: php-general@lists.php.net
Subject: [PHP] replacing first occurence
What function can I use to replace just the first occurence of a "," in
a string? Thank you
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php