ramli Posted June 18, 2007 Share Posted June 18, 2007 Hellow, I want to format my id's in a sertan way however i am not sure how t approatch this problem. i want to write a function that formats a 0 to D000000. However i alsow wat to be eable to convert them back from D000000 to 0 to make calculations with it. For exaple adding 1 to create D100000. Any help would be mutch appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/56107-solved-format-number-and-text/ Share on other sites More sharing options...
cooldude832 Posted June 18, 2007 Share Posted June 18, 2007 first off you need a bit of mastery on the keyboard, secondly? what is your question? Quote Link to comment https://forums.phpfreaks.com/topic/56107-solved-format-number-and-text/#findComment-277119 Share on other sites More sharing options...
ramli Posted June 19, 2007 Author Share Posted June 19, 2007 first english is not my mother language. second my question is how do i convert a 0 to D000000. Quote Link to comment https://forums.phpfreaks.com/topic/56107-solved-format-number-and-text/#findComment-277462 Share on other sites More sharing options...
ToonMariner Posted June 19, 2007 Share Posted June 19, 2007 may sound silly but what is the significance of this format? I have just googled it and found nothing useful. if there is some mathematical conversion going on then knowing so would help other wise it appears you simply want to take your number - put a 'D' in front of it and then pad some 0's after it to make it a 7 char string. which would be <?php $id = 1; $id = 'D' . $id; str_pad($id, 7 , "0"); ?> that woudl convert '1' to D100000 Quote Link to comment https://forums.phpfreaks.com/topic/56107-solved-format-number-and-text/#findComment-277473 Share on other sites More sharing options...
ramli Posted June 19, 2007 Author Share Posted June 19, 2007 that is correct it is for formatting a invoice id thx for the help Quote Link to comment https://forums.phpfreaks.com/topic/56107-solved-format-number-and-text/#findComment-277506 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.