Recommended 10 articles for PHP sprintf () functions

Source: Internet
Author: User
Tags crc32 learn php locale sprintf
This article gives you a summary of 7 kinds of PHP commonly used print output functions, respectively, is Echo,print,printf,sprintf,print_r,var_dump,die, I hope we can help you learn PHP This article has been to learn all the functions in PHP for output information, classification comparison to learn the same points and different points, master the necessary skills in daily development. Development will need to debug code, and PHP debugging code can not be like the language of iOS compiler to step through development software such as Xcode, so developers who develop PHP will usually print related information through the output function to debug the code. The commonly used printout functions in PHP are explained in step Echoecho functions can output multiple strings at the same time, with multiple parameters, but do not require the use of parentheses, nor return values. However, if there is no problem with parentheses, the function will need parentheses: Echo ' tech blog <br> '; Echo (' echo ' can also be enclosed in parentheses <br

1. Detailed introduction of PHP printout function summary

Introduction: This article gives you a summary of 7 kinds of PHP commonly used print output functions, respectively, is Echo,print,printf,sprintf,print_r,var_dump,die, I hope to learn PHP can help you

2. Basic knowledge of C #: Basics (4) Inheritance

Summary: The format () method of a regular type of formatted string class is used to create a formatted string and to concatenate multiple string objects. Students familiar with C language should remember the C language of the sprintf () method, the two have similarities. There are two overloaded forms of the format () method. Format (string format, Object ... args) a new string that uses the local locale to develop a string format and parameters to generate a new formatted string. Format (Locale

3. PHP Common string Output method analysis (echo,print,printf and sprintf)

Introduction: This article mainly introduces PHP commonly used string output method, combined with instance form analysis of ECHO, print, printf and sprintf output string specific usage and related use skills, the need for friends can refer to the following

4. Python time formatting

Summary: The operation of function strftime () is somewhat similar to sprintf (): Recognizes a collection of formatting commands that begin with a percent sign (%), and the formatted output is placed in a string. The format command describes the exact representation of the various date and time information in the string strdest. Other characters in the format string are placed in the string as is. The format commands are listed below, and they are case-sensitive. %a Day of the week%a the full name of the day of the week%b month of the abbreviated%b month full name%c standard date of the time string%c years after the two digit%d decimal ...

5. A PHP generated short URL function

Introduction: Short URLs compared to everyone is not strange, especially the application of micro-Bo is to bring it fire, in fact, to achieve this function is also very simple. &lt;? PHP/** * Short URL */function Urlshort ($url) {$url = CRC32 ($url); $result = sprintf (&quot;%u&quot;, $url); $sUrl = "; wh Ile ($r ...

6. PHP function Note

Introduction: 1.sprintf ('%.1f ', $str) weird, is it rounding? &lt;? PHP echo sprintf ('%.1f ', 7.52); 7.5 echo &quot;\n&quot;; echo sprintf ('%.1f ', 7.55); 7.5 echo &quot;\n&quot;; echo sprintf ('%.1f ', 7.5 ...

7. A PHP generated short URL function

Introduction: Short URLs compared to everyone is not strange, especially the application of micro-Bo is to bring it fire, in fact, to achieve this function is also very simple. &lt;? PHP/** * Short URL */function Urlshort ($url) {$url = CRC32 ($url); $result = sprintf (&quot;%u&quot;, $url); $sUrl = "; wh Ile ($r ...

8. The application of printf and sprintf

Description: <?php printf (' B:%b <br>c:%c <br>d:%d <bf>f:%f ', 80, 80, 80, 80); echo ' <br/> '; printf ('%0.2f <br>%+d <br>%0.2f <br> ', 8, 8, 1235.456); printf (' th ...

9. About sprintf interception of decimals

Introduction: Question: Retain 1 decimal places, not rounded, for integer when 0 many people say with sprintf ('%.1f ', $str), but the results are still problematic, and finally solved with this method: Echo sprintf ('%.1f ', Floor ($STR)); {Code ...} Not to say no rounding? Why ...?

10. About sprintf interception of decimals

Introduction: Question: Retain 1 decimal places, not rounded, for integer when 0 many people say with sprintf ('%.1f ', $str), but the results are still problematic, and finally solved with this method: Echo sprintf ('%.1f ', Floor ($STR)); {Code ...} Not to say no rounding? Why ...?

"Related question and answer recommendation":

"Python|scapy" sprintf output raw_string Turn string

php-printf Controlling line breaks

PHP-About sprintf intercept decimal problem

PHP-How to return the Print_r information as a string

php-sprintf () [<a href= ' function.sprintf ' >function.sprintf</a>]

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.