When constructing various types of data into strings, the powerful features of sprintf seldom disappoint you. Since sprintf and printf have almost the same usage, but the printing destination is different, the former is printed into the string, and
$bookSQL =sprintf ("UPDATE book SET pass=%s WHERE id=%d",
Getsqlvaluestring ($_post[' list '], "text"),
Getsqlvaluestring ($_get[' id '], "int"));
Getsqlvaluestring This function can be replaced by other functions
But here's the function of sprintf (
When constructing various types of data into strings, the powerful features of sprintf seldom disappoint you. Since sprintf and printf are almost the same in usage, the print destination is only different. The former is printed to the string, and
$bookSQL =sprintf ("UPDATE book SET pass=%s WHERE id=%d",Getsqlvaluestring ($_post[' list ', "text"),Getsqlvaluestring ($_get[' id '], "int"));Getsqlvaluestring This function, you can replace it with another function.But use the sprintf () function
printf is probably the second function that many programmers come into contact with when they start learning C (I guess the first one is main), but it's an old friend, but do you know much about this old friend? Do you know much about his twin
This article describes the implementation of PHP based on JS sprintf function. Share to everyone for your reference, specific as follows:
The functions are as follows:
The first parameter is a string containing the "%s", and the other
This article brings you the content is about PHP sprintf () function How to achieve price format, there is a certain reference value, the need for friends can refer to, I hope to help you.
Summary: Different business scenarios, the implementation
Control floating-point printing formatThe printing and formatting control of floating point numbers is a common function of sprintf, floating-point numbers use the format character "%f" control, the default is to retain 6 digits after the decimal,
sprintfFormats the string.Syntax: string sprintf (string format, mixed [args] ...);return value: StringFunction type: Data processingContent DescriptionThis function is used to format a string. The parameter format is the converted form, starting
Document directory
Syntax
Description
Syntax
sprintf(format,arg1,arg2,arg++)
Parameters
Description
Format
Required. Conversion format.
Arg1
Required. Specifies the parameter inserted at the first % symbol
Notes for studying sprintf () functions in PHP. Sprintf format the string. Syntax: stringsprintf (stringformat, mixed [args]...); return value: string type: data processing content description this function is used to format the string.
Study Notes on sprintf () functions in PHP, read notes on sprintf () functions in PHP, and sprintf formats the strings. Syntax: stringsprintf (stringformat, mixed [args]...); return value: string type: data processing content description this
This article mainly introduces the usage of php sprintf functions. For more information, see
Control floating point print formatThe printing and format control of floating point numbers is a common function of sprintf. floating point numbers are
$bookSQL =sprintf ("UPDATE book SET pass=%s WHERE id=%d",
Getsqlvaluestring ($_post[' list '], "text"),
Getsqlvaluestring ($_get[' id '], "int"));
Getsqlvaluestring This function can be replaced by other functions
But here's the function of
Sprintf format the string. Syntax: stringsprintf (stringformat, mixed [args]…); Return Value: string type: description of data processing content this function is used to format the string. The format parameter is the conversion format, starting
Grammar
sprintf (format,arg1,arg2,arg++)
Parameters
Description
Format
Necessary. Conversion format.
Arg1
Necessary. Specify the parameter to be inserted into the first% symbol in the format string.
Sprintf
Format the string.
Syntax: string sprintf (string format, mixed [args]...);
Return Value: String
Correspondence type: Data Processing
Description
This function is used to format the string. The format parameter is the conversion format,
Control floating point print formatThe printing and format control of floating point numbers is a common function of sprintf. Floating Point Numbers are controlled by the format character "% f". By default, the six digits after the decimal point are
This article mainly introduces the usage of php sprintf functions. For more information, see
Control floating point print formatThe printing and format control of floating point numbers is a common function of sprintf. floating point numbers are
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.