Try this.....

$orig_string = "123456789";
$insert_string = "-";
$position = "4";
$newstring=substr_replace($orig_string, $insert_string, $position, 0);
echo $newstring;

Regards,
Julianne


From: eriknjenga@gmail.com
Date: Mon, 25 Oct 2010 20:12:49 +0300
To: skunkworks@lists.my.co.ke
Subject: [Skunkworks] PHP String Manipulation

Anyone got an idea of an internal PHP function that would enable me to insert a symbol e.g. '-' after every 4 characters in a String? e.g. 12345678 becomes 1234-5678.

--

Thanks and Regards,
Erick Njenga Nyachwaya,
M: +254-725-008-790







_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke