fixed preceeding 0's
Posted on 2014-10-18
I am using Ckaephp but php will do for this.
I just need to know how to store preceding 0's in front of a integer variable so I have always 6 digits.
I saw sprintf but I dont know how to keep 6 digits to a number always.
$InvoiceNo =1; but I want $InvoiceNo =000001;
I also want to add to this number $InvoiceNo +=1; will append the 0's and 10 wil be 000010
$this->request->data['TimesheetDate'][$key]['invoice']=$InvoiceNo ; will add this number to the DB and this currently works without leading 0's