توابع localeconv() در PHP

مثال

جستجوی اطلاعات فرمت عدد محلی ایالات متحده:

<?php
setlocale(LC_ALL,"US");
$locale_info = localeconv();
print_r($locale_info);
?>

مثال‌های اجرایی

تعریف و کاربرد

localeconv() تابع یک آرایه شامل اطلاعات فرمت عدد و ارز محلی را برمی‌گرداند.

localeconv() تابع به مجموعه‌ای از عناصر زیر برمی‌گردد:

  • [decimal_point] - کاراکتر نقطه‌ی اعشاری
  • [thousands_sep] - علامت جداکننده هزاره‌ها
  • [int_curr_symbol] - علامت ارز (مثلاً: USD)
  • [currency_symbol] - علامت ارز (مثلاً: $)
  • [mon_decimal_point] - کاراکتر نقطه‌ی اعشاری ارز
  • [mon_thousands_sep] - علامت جداکننده هزاره‌های ارز
  • [positive_sign] - کاراکتر علامت مثبت
  • [negative_sign] - کاراکتر علامت منفی
  • [int_frac_digits] - تعداد دهم‌ها عمومی بین‌المللی
  • [frac_digits] - تعداد دهم‌ها عمومی محلی
  • [p_cs_precedes] - اگر علامت ارز قبل از عدد مثبت نمایش داده می‌شود، True (1) است، اگر بعد از آن نمایش داده می‌شود، False (0) است
  • [p_sep_by_space] - اگر فضایی بین علامت ارز و عدد مثبت وجود دارد، True (1) است، در غیر این صورت False (0) است
  • [n_cs_precedes] - True (1) if the currency symbol is displayed before a negative value, otherwise False (0)
  • [n_sep_by_space] - True (1) if there is a space between the currency symbol and the negative value, otherwise False (0)
  • [p_sign_posn] - Formatting Options:
    • 0 - Write the quantity and currency symbol in parentheses
    • 1 - Add a plus sign before the quantity and currency symbol
    • 2 - Add a plus sign after the quantity and currency symbol
    • 3 - Add a plus sign directly before the currency symbol
    • 4 - Add a plus sign directly after the currency symbol
  • [n_sign_posn] - Formatting Options:
    • 0 - Write the quantity and currency symbol in parentheses
    • 1 - Add a hyphen before the quantity and currency symbol
    • 2 - Add a hyphen after the quantity and currency symbol
    • 3 - Add a hyphen directly before the currency symbol
    • 4 - Add a hyphen directly after the currency symbol
  • [grouping] - Display the array of number combinations (e.g., 3 indicates 1 000 000)
  • [mon_grouping] - Display the array of currency number combinations (e.g., 2 indicates 1 00 00 00)

Tip:To define local settings, please see setlocale() Functions.

Tip:To view all available language codes, please visit ourLanguage Code Reference Manual.

Syntax

localeconv()

Technical Details

Return Value: Returns data based on the current locale set by setlocale().
PHP Version: 4.0.5+