Jump to content

[SOLVED] Format Number and Text


ramli

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
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.