"PHP number format()"의 두 판 사이의 차이

(새 문서: ==개요== ;number_format() <source lang='php'> $num = 1234.5678; echo number_format($num); echo number_format($num,2); echo number_format($num,6); # 1,235 # 1,234.57 # 1,234.567800 <...)
 
잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
(사용자 2명의 중간 판 15개는 보이지 않습니다)
1번째 줄: 1번째 줄:
{{DISPLAYTITLE:PHP number_format()}}
==개요==
==개요==
;number_format()
;PHP number_format()
<source lang='php'>
<syntaxhighlight lang='php' run>
$num = 1234.5678;
$num = 1234.5678;
echo number_format($num);
echo number_format($num) ."\n";         # 1,235
echo number_format($num,2);
echo number_format($num,2) ."\n";       # 1,234.57
echo number_format($num,6);
echo number_format($num,2,'','') ."\n"; # 123457
# 1,235
echo number_format($num,2,'.','') ."\n"; # 1234.57
# 1,234.57
echo number_format($num,6) ."\n";        # 1,234.567800
# 1,234.567800
</syntaxhighlight>
</source>


==같이 보기==
==같이 보기==
*[[round()]]
* [[PHP money_format()]]
* [[PHP sprinf()]]
* [[PHP prinf()]]
* [[PHP sscanf()]]
* [[PHP round()]]
* [[함수 round()]]
* [[함수 toFixed()]]
* [[함수 thousand_format()]]
* [[함수 number_format()]]
 
==참고==
*http://php.net/manual/en/function.number-format.php


[[분류: PHP]]
[[분류: PHP]]

2020년 11월 2일 (월) 02:35 기준 최신판

1 개요[ | ]

PHP number_format()
$num = 1234.5678;
echo number_format($num)  ."\n";         # 1,235
echo number_format($num,2) ."\n";        # 1,234.57
echo number_format($num,2,'','') ."\n";  # 123457
echo number_format($num,2,'.','') ."\n"; # 1234.57
echo number_format($num,6) ."\n";        # 1,234.567800

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}