Saturday, 10 August 2013

PHP :replace single digit number with pre leading 0

PHP :replace single digit number with pre leading 0

i have the string for example , hello77boss2america-9-22-fr99ee-9 , From
this string all the single digit must be converted to pre leading 0...for
example result must be like hello77boss02america-09-22-fr99ee-09
I am new to php kindly guide me please.I tried below code
str_replace("(0-9)","0",$num);

No comments:

Post a Comment