How to add zeros before number to reach on certain digit in php

 

I want to change 140 into 000149 using php function


Answer
 

str_pad(149, 6, "0", STR_PAD_LEFT)


 

str_pad(149, 6, "0", STR_PAD_LEFT)