Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP math addition

Status
Not open for further replies.

9h1lo

Technical User
Sep 28, 2009
9
MT
I have a simple math function

i query mysql and get a result such as 024 or 003

now i am getting the resultent variable and adding to it
by simply doing $newresult=$result +1

the thing is I get the newresult as 25 or 3 but I want them as 025 or 004 as I have further procesing to run on this variable

thanks
 
solved it:

printf("%03s\n", $lastid+1);
 
or better

$newidno=sprintf("%03s\n", $lastid+1);


to set as variable
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top