Home >Backend Development >PHP Tutorial >10 recommended articles about sprintf
The difference between the usage of sprintf and printf functions in php. The following is an example of sprintfprintf: rounding to two decimal places Explain the meaning of %0.2f: % represents the starting character 0 represents the blank space filled with 0 2 represents the decimal point must occupy two digits f represents conversion to floating point number Conversion characters =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-% Print the percent sign without conversion. b Convert integer to binary. c Convert the integer to the corresponding ASCII character. d Convert integer to decimal place. Convert f times precision numbers to floating point numbers. o Convert an integer to octal. Convert s integer to string. x integer is converted to lower case hexadecimal. X integer is converted to uppercase hexadecimal. The difference between printf and sprintf 1. printf function: int printf ( string format [, mixed args [,1
1. Recommended 7 articles about fprintf
Introduction: The difference between the usage of sprintf and printf functions in PHP. The following is an example of sprintfprintf: rounded to two decimal places. Explain the meaning of %0.2f: % means the starting character 0 Indicates that the blanks are filled with 0. 2 indicates that there must be two digits after the decimal point. f indicates conversion into floating point numbers. Conversion characters =-=-=-=-=-=-=-=-=-=-=-=-=-=- =-% prints out the percent sign without conversion. b Convert integer to binary. Recommended 10 articles
## Introduction: The difference between the usage of sprintf and printf functions in php. The following is a sprintf printf Example: Rounding to two decimal places. Explain the meaning of %0.2f: % represents the starting character. 0 represents the blank space filled with 0. 2 represents that two decimal places must be occupied. f represents conversion to a floating point number. Conversion characters =-=-=- =-=-=-=-=-=-=-=-=-=-=-=-% Print out the percent sign without conversion. b Convert integer to binary. c Convert integer to corresponding. ...
3.Recommended articles about the string function crc32()
Introduction: PHP learning series (1) - String processing function (3), PHP function 11, crc32() function calculates the crc32 polynomial of a string to generate 32 bits of the string parameter. Cyclic redundancy check code polynomial. This function can be used to verify the integrity of the data. Syntax: crc32(string) Note: Since PHP's integers are signed, many crc32 check codes will return negative integers, so you need to use sprintf. () or the "%u" format character of printf() to...
4.Recommended 10 articles about the php sprintf() function
Introduction: This article summarizes and introduces 7 commonly used PHP print output functions, namely echo, print, printf, sprintf, print_r, var_dump, die, I hope it can be helpful for everyone to learn PHP. This article has been to learn all the functions used to output information in PHP, classify and compare them to learn their similarities and differences, and master the essentials in daily development. skills. Development must require debugging code, and PHP debugging code cannot be single-step debugged through development software such as Xcode like the compiler language of iOS...
5.Detailed introduction to the summary of PHP print output functions
##Introduction: This article summarizes and introduces 7 commonly used PHP functions. The print output functions are echo, print, printf, sprintf, print_r, var_dump, and die. I hope it can be helpful to everyone learning php6.
Basic knowledge of C# Organizing: Basic knowledge (4) Inheritance
简介:常规类型的格式化String类的format()方法用于创建格式化的字符串以及连接多个字符串对象。熟悉C语言的同学应该记得C语言的sprintf()方法,两者有类似之处。format()方法有两种重载形式。format(String format, Object... args) 新字符串使用本地语言环境,制定字符串格式和参数生成格式化的新字符串。format(Locale 7. php常用字符串输出方法分析(echo,print,printf及sprintf)
简介:这篇文章主要介绍了php常用字符串输出方法,结合实例形式分析了echo、print、printf及sprintf输出字符串的具体用法与相关使用技巧,需要的朋友可以参考下 8. python 时间格式化
简介:函 数strftime()的操作有些类似于sprintf():识别以百分号(%)开始的格式命令集合,格式化输出结果放在一个字符串中。格式化命 令说明串strDest中各种日期和时间信息的确切表示方法。格式串中的其他字符原样放进串中。格式命令列在下面,它们是区分大小写的。 %a 星期几的简写%A 星期几的全称%b 月分的简写%B 月份的全称%c 标准的日期的时间串%C 年份的后两位数字%d 十进制 ... 9. 一个PHP生成短网址函数
简介:短网址相比大家都不陌生吧,特别是微博上的应用更是把它带火了,其实要实现这个功能也很简单。 <?php /** * 短网址 */ function urlShort($url){ $url= crc32($url); $result= sprintf("%u", $url); $sUrl= ''; while($r ... 10. PHP 函数注意
简介:1.sprintf('%.1f',$str) 诡异啊算是四舍五入吗? <?php echo sprintf('%.1f',7.52); // 7.5 echo "\n"; echo sprintf('%.1f',7.55); // 7.5 echo "\n"; echo sprintf('%.1f',7.5 ... 【相关问答推荐】: PHP中字符串拼接,sprintf和直接拼接相比有什么优势/劣势吗?
The above is the detailed content of 10 recommended articles about sprintf. For more information, please follow other related articles on the PHP Chinese website!