> From: Justin French [mailto:[EMAIL PROTECTED]] > Sent: Friday, July 19, 2002 7:39 AM > To: php > Subject: [PHP] best way to delete char# 4-7 from a string? > > > Hi, > > Let's say I have the following string: > > $str = 'abcdefghijklmnop'; > > ...and I want to strip out char #'s 4 through to 7 (d,e,f,g) > > $strip_start = 4; > $strip_end = 7; > > ($str would now be 'abchijklmnop';) > > THEN I want to plug a new string $filler at position 4 > > $filler = '4567'; > > ($str would now be 'abc4567hijklmnop')
Hi, substr_replace() does exactly what you want. $newstring = substr_replace($str, "4567", 4, 4); Regards Joakim Andersson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php