On Thu, Apr 15, 2004 at 06:11:57PM -0400, John W. Holmes wrote: > Rob Ellis wrote: > >On Thu, Apr 15, 2004 at 04:31:09PM -0500, BOOT wrote: > >> > >>I'm looking for a way to take a 7 digit number and put it into xxx-xxxx > >>format. > >> > >>So basically the logic is to count 3 characters into $number and insert a > >>"-" there. > > > >substr_replace($string, '-', 3, 0); > > Won't that replace the number, though, not insert the dash?
No, it does the right thing. The last 0 is the number of characters to replace. - Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php