Home > Backend Development > PHP Tutorial > Note on PHP functions

Note on PHP functions

巴扎黑
Release: 2016-11-29 11:01:23
Original
1501 people have browsed it

1.sprintf('%.1f',$str) is weird, is it rounding?

<?php  
  echo  sprintf(&#39;%.1f&#39;,7.52);  // 7.5  
  echo "\n";  
  echo  sprintf(&#39;%.1f&#39;,7.55); // 7.5  
  echo "\n";  
  echo  sprintf(&#39;%.1f&#39;,7.56); // 7.6
Copy after login


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template