I need to pad the integer part with 0, the integer part must be at least 2 characters
str_pad( 2 ,2,\"0\",STR_PAD_LEFT);// 02 -> works str_pad( 22 ,2
A fast solution: http://codepad.org/EXcbqGos
$num = 2.11; echo str_pad( floor($num) ,2,"0",STR_PAD_LEFT).substr($num-floor($num), 1);
It will only work for non-negative numbers.