smerny Posted September 30, 2009 Author Share Posted September 30, 2009 yea working... i'm going to sleep now, but if you wanna check it out here and see if you can figure out how to get the octals to line up better between the two lines... go for it thanks for all the help guys Quote Link to comment https://forums.phpfreaks.com/topic/175891-space-every-3-characters/page/3/#findComment-927484 Share on other sites More sharing options...
sasa Posted September 30, 2009 Share Posted September 30, 2009 I do realize that the math in str_pad ($l-($l%3)+3) will cause the correct numbers to be padded (e.g. 111 would become 000 111.) If you're concerned about that, just do a quick check to see if the modulus is 0 or not. use ceil($l/3)*3 Quote Link to comment https://forums.phpfreaks.com/topic/175891-space-every-3-characters/page/3/#findComment-927550 Share on other sites More sharing options...
Psycho Posted September 30, 2009 Share Posted September 30, 2009 I do realize that the math in str_pad ($l-($l%3)+3) will cause the correct numbers to be padded (e.g. 111 would become 000 111.) If you're concerned about that, just do a quick check to see if the modulus is 0 or not. use ceil($l/3)*3 I knew there had to be an easier method and was even trying to use ceil() but couldn't figure out a way to make it work. Good one. Quote Link to comment https://forums.phpfreaks.com/topic/175891-space-every-3-characters/page/3/#findComment-927671 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.