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
https://forums.phpfreaks.com/topic/56107-solved-format-number-and-text/
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

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.