NumberFormatter::format

numfmt_format

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)

NumberFormatter::format -- numfmt_formatBir sayıyı biçemler

Açıklama

Nesne yönelimli kullanım

public NumberFormatter::format(int|float $değer, int $tür = ?): string

Yordamsal kullanım

numfmt_format(NumberFormatter $biçemleyici, int|float $değer, int $tür = ?): string

Bir sayıyı biçemleyici kurallarına uygun olarak biçemler.

Değiştirgeler

biçemleyici

NumberFormatter nesnesi.

değer

Biçemlenecek değer. int veya float türünde olabilir, diğer değerler bir sayısal değere dönüştürülür.

tür

Kullanılacak biçemleme türü.

Dönen Değerler

Bir hata oluşursa false, aksi takdirde biçemlenmiş değeri içeren dizge döner.

Örnekler

Örnek 1 - numfmt_format() örneği

<?php
$fmt 
numfmt_create'tr_TR'NumberFormatter::DECIMAL );
$data numfmt_format($fmt1234567.891234567890000);
if(
intl_is_failure(numfmt_format($fmt))) {
    
report_error("Biçemleyici hatası");
}
?>

Örnek 2 - Nesne yönelimli kullanım örneği

<?php
$fmt 
= new NumberFormatter'tr_TR'NumberFormatter::DECIMAL );
$fmt->format(1234567.891234567890000);
if(
intl_is_failure($fmt->getErrorCode())) {
    
report_error("Biçemleyici hatası");
}
?>

Yukarıdaki örneğin çıktısı:

1.234.567,891

Ayrıca Bakınız

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top