spyros1234 Posted July 22, 2007 Share Posted July 22, 2007 Hello I have a 6 digit number and I want to split it to 2 separate numbers do you know how can I do this ? For example the number 200509 I want to split it in to 2005 and 09. Thank you. Link to comment https://forums.phpfreaks.com/topic/61207-how-can-i-split-a-6-digit-number-in-to-2-separate-numbers/ Share on other sites More sharing options...
BillyBoB Posted July 22, 2007 Share Posted July 22, 2007 like: <?php $num = "123456"; $num1 = substr($num,0,4); $num2 = substr($num,4,2); echo $num1 . "-" . $num2; ?> edit i saw you wanted 4 numbers and 2 Link to comment https://forums.phpfreaks.com/topic/61207-how-can-i-split-a-6-digit-number-in-to-2-separate-numbers/#findComment-304530 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.