Jump to content

space every 3 characters


smerny

Recommended Posts

  • Replies 52
  • Created
  • Last Reply

 

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.