I'am doing a call to a database to retrieve an ID of a specific item. Usually there are the ids like: 1, 2, 14, 23, .... I need to get the ID from a DB and output it 4 digit number.
For exemple:
My result ID is: 1. Now i when i have this value, i want it to become 0001. Or if my result id is 13, it should became 0013, etc.
How can i achieve that with php without changing the real ID in database?
Same as always.
sprintf("%04d", $num)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With