monkeytooth Posted October 20, 2010 Share Posted October 20, 2010 Looking for ideas and advise on this one. I want to take a 10 digit number and 1234567890 and format it like 132-456-7890 what would be my best bet as choice of methods to do this? Link to comment https://forums.phpfreaks.com/topic/216343-formating-a-numeric-string/ Share on other sites More sharing options...
sasa Posted October 20, 2010 Share Posted October 20, 2010 try <?php $test = 1234567890; echo $test = substr($test, 0, 3).'-'. substr($test,3,3).'-'.substr($test,6); ?> Link to comment https://forums.phpfreaks.com/topic/216343-formating-a-numeric-string/#findComment-1124272 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.