TAILIEUCHUNG - PHP and MySQL by Example- P4

Tham khảo tài liệu 'php and mysql by example- p4', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Figure . Precision of numbers. Output from Example . In the next example printf will format a string and a number. Example . php product_name Black shoes product_price 1 printf Product s will cost dollars product_name product_price Explanation 1 The control string contains two format specifiers s and . The variable product_name the first argument will be printed according to the first format specifier s a string. The second argument product_price will be printed according to the second format specifier . In this case 6 refers to total number of digits that this number can occupy and .2 specfiies a precision of 2 places to the right of the decimal point. If the number is larger than 6 printf will not truncate it. It just might not look the way you had envisioned it. See Figure . Please purchase PDF Split-Merge on to remove this watermark. Figure . Output from Example . Table shows the most common format specifiers. The format specifier can be modified by placing specifying a precision left or right justification padding characters and so on as shown in Table . Table . Modifiers for the printf Format Specifier Modifier Example Format . .2f Specifies a precision of two digits to the right of the decimal point in a floating-point number integer 8d Specifies number of characters for this argument to be displayed . field width of 8 digits - - 30s Causes the formatting to be left justified . left-justified floatingpoint number with a field width of 8 or left-justified 30-space string 0 08d Pads the number with 0s There are some other formatting functions similar to the printf function differing primarily in how the output is displayed. The sprintf Function This function is identical to printf except that instead of displaying the formatted string sprintf returns the formatted string so that you can assign it to a variable. See Example . Format string sprintf string format mixed args mixed . .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.