Grammar
sprintf (format,arg1,arg2,arg++)
Parameters
Description
Format
Necessary. Conversion format.
Arg1
Necessary. Specifies the parameter that is inserted into the first% symbol in the format
Control floating-point printing formatThe print and format control of floating-point numbers is a common feature of sprintf, and floating-point numbers use the format "%f" control, which retains 6 digits after the decimal point by default, such as:
When you construct various types of data into strings, the powerful features of sprintf rarely disappoint you. Because sprintf is almost the same as printf in usage, it's just a different destination for printing, which is printed to a string, and
PHPsprintf () function usage. We know that the sprintf () function writes formatted strings into a variable, and we often see this type of code. next I will introduce how to use the sprintf () function, if you have any need, we know that the sprintf
The sprintf () function is used to write a formatted string into a variable.
Definition and usageThe sprintf () function is used to write a formatted string into a variable.
Grammarsprintf (format,arg1,arg2,arg++) parameter descriptionFormat
Php
The output function has
Echo ()
function and
Print ()
Functions and formatted output functions
printf ()
Functions and
sprintf ()
Function.
One
Echo ()
Function
Echo ()
The function outputs one or more strings, which can be
Sprintf () format the output function (image)Function: sprintf () is used for formatting output.Usage: This function is called in int sprintf (char * string, char * format, arg_list );Note: The usage of the sprintf () function is the same as that of
PHP sprintf () function
Replace the percent sign (%) symbol with a variable that is passed as a parameter:
Definitions and usage
The sprintf () function writes the formatted string to the variable.
The Arg1, arg2, + + parameters are
In Windows, programmers who use printf in the text mode and the C language programming history in the Command column often prefer the printf function. Even though simple commands (such as puts) can be used, it is not surprising that printf appears
The sprintf () function writes formatted strings to a variable.
The code is as follows:
// Sprintf () function. the returned value is a formatted string.String sprintf (string $ format [, mixed $ args [, mixed $...])$ Y = 11;$ M = 3;$ D = 9;$
See the topic believe that a lot of small partners will think of using rounding method to achieve, this is also a way, then there are other methods, we will take you to understand the PHP implementation of two decimal places to save several
Original address:
http://blog.csdn.net/liukun321/article/details/5633249
SPRINTF series functions and variable parameter functions collectionThe sprintf function is defined as follows:
int sprintf (char * szbuffer, const char * szformat, ...);The
Ccproxy is a home-grown proxy server software that supports proxy protocols such as HTTP, FTP, Gopher, SOCKS4/5, Telnet, Secure (HTTPS), News (NNTP), RTSP, and MMS. Because of its easy to use, user-friendly interface, very suitable for the traffic
PHPsprintf () function example parsing. Copy the code as follows :? Phpsprintf () function. the returned value is the formatted string stringsprintf (string $ format [, mixed $ args [, mixed $...]) $ y11; $ m3; $ d9;
The code is as follows:
//
In PHP development we may encounter a line of words with double quotation marks to make that line of words into a string, and if there are other characters in a line of words, and so on, we use double quotation marks or single quotation marks are
Transferred from: http://blog.csdn.net/anye3000/article/details/6593551Programmers with a history of C writing tend to like the printf function in particular. Even though simpler commands (such as puts) can be used, printf appears in the "hello of
Sprintf
Edit entry
编辑词条 -->
The string formatting command is mainly used to write formatted data into a string. Sprintf is a variable parameter function, which often causes problems when used, and as long as there is a problem,
I. Graphic Text Functions85. The string function is displayed at the current position of outtext ().86. outtextxy () shows the string function at (x, y ).87. sprintf () format the output functionIi. Graphic text settings88. settextstyle () sets the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.