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? Quote 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); ?> Quote Link to comment https://forums.phpfreaks.com/topic/216343-formating-a-numeric-string/#findComment-1124272 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.