Примеры: $a = sprintf("%4.2f",$num); $a = sprintf("%06X%06X",$num1,$num2); $a = sprintf("%04i",$num);