nak angka 1 jadi format 000001
Bagi insert dalam db, guna sprintf
$angkagilir = sprintf("%06d",$list_id);
sekadar paparan, guna printf
$angkagilir = printf("%06d",$list_id);
hadkan titik perpuluhan
$metrica = 5.123;
$ra = 2.345;
echo ($metrica - $ra); // 2.778
printf("%.1f",($metrica - $ra)); // 2.8
printf("%.6f",($metrica - $ra)); // 2.778000
ayus dan syuhada
www.nursyuhada.com
Output a formatted string
Tuesday, May 08, 2007
Posted by ayus at 3:06 AM
Labels: programming
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment