nezbo Posted March 19, 2008 Share Posted March 19, 2008 i have the got a var and i want to make it 4 number long... e.g. if i have 700 i want to make it 0700. is there a function or class to do this ? Quote Link to comment https://forums.phpfreaks.com/topic/96985-how-to-set-a-700-to-0700/ Share on other sites More sharing options...
Psycho Posted March 19, 2008 Share Posted March 19, 2008 Assuming your var is named value: value = '0000' + value; value = value.substr(value.length-4, 4); Quote Link to comment https://forums.phpfreaks.com/topic/96985-how-to-set-a-700-to-0700/#findComment-496407 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.