A simple question.
I have integer variable $a=2, how can I display it in string format: "SN0002" with 4 '0' inserted? thanks.
michael123
0
Junior Poster in Training
Recommended Answers
Jump to PostYou may try the follwoing. I used the similar to form my invoice number:
$order_num = 'SN'.substr('00000'.$a,-5,5); // e.g. SN00002
All 3 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.