Jump to content

Recommended Posts

Hey, I was wondering how I could concatenate zeros at the beginning of a integer. For example, I would want all variables to have 8 digits so I concatenate. 8 zeros in front of 5 (00000005), 5 zeros in front of 4536 (000004536), etc. I would do this so that when I'm ordering a mySQL database by a field called "score" that it orders correctly. If I don't do this it orders 34880 after 120661. I would want it to automatically calculate how many zeros it would need to concatenate at the beginning of a number.  Thanks for reading.

Joel
wintallo@gmail.com
Link to comment
https://forums.phpfreaks.com/topic/27051-solved-concatenate-zeros/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.