intl

Fatal error: 'ext/standard/php_smart_str.h' file not found

∥☆過路亽.° 提交于 2019-12-01 11:21:44
问题 I downloaded MacOS Mojave and did a clean installation on my mid 2012 macbook Pro. Installed XCode with command line tools. Got native Apache and PHP working, with PEARL, PECL and last version of ICU (63.1) for later use of Intl extension. But every attempt of Intl instalation has failed. Before the clean instalation, i found a intl.so on a pen drive and used ICU version 54, but isn't the best way to get things working for a development enviroment. In the end, i'm stuck with PECL incapable of

Why Normalizer::normalize (PHP) doesn't work?

前提是你 提交于 2019-12-01 03:43:07
问题 I'm trying to normalize strings with characters like 'áéíóú' to 'aeiou' to simplify searches. Following the response to this question I should use the Normalizer class to do it. The problem is that the normalize function does nothing. For example, that code: <?php echo 'Pérez, NFC: ' . normalizer_normalize('Pérez', Normalizer::NFC) . ' NFD: ' .normalizer_normalize('Pérez', Normalizer::NFD) . ' NFKC: ' .normalizer_normalize('Pérez', Normalizer::NFKC) . ' NFKD: ' .normalizer_normalize('Pérez',

PHP 5.3 seems to be missing Intl extension by default

主宰稳场 提交于 2019-11-30 18:36:29
My system is Ubuntu 12.04, PHP 5.3, and I'm trying to run some basic Intl code like this: <?php $coll = collator_create('en_US'); $result = collator_compare($coll, "string#1", "string#2"); and it outputs PHP Fatal error: Call to undefined function collator_create() Wasn't Intl extension supposed to be bundled with PHP since version 5.3? PHP was installed via apt-get with this command line (I don't use Apache): apt-get install php5 php5-cli php5-mysql php5-cgi php5-fpm php5-curl php-apc php5-memcache php5-memcached php5-common php5-gd php-xml-parser php-pear php5-imap php5-mcrypt php5-xdebug

Localized (short) month names using IntlDateFormatter in PHP?

扶醉桌前 提交于 2019-11-30 12:42:53
On my Windows development machine, I have set the locale to ita : setlocale(LC_TIME, 'ita'); echo strftime('%b'); // dic While (I suppose, can't test right now) on a *nix system, I should use it : setlocale(LC_TIME, 'it'); If I try to set it on my Windows it doesn't work, printing Dec . It seems I can't rely on setlocale() , so I should use IntlDateFormatter as suggested by @hakre. However, I can find the constant that gives me the month name and the short one: IntlDateFormatter::NONE (integer) Do not include this element IntlDateFormatter::FULL (integer) Completely specified style (Tuesday,

Mac OS: Intl extension is not loaded

送分小仙女□ 提交于 2019-11-30 09:47:57
macOS Mojave 10.14.3 PHP 7.1.23 Prestashop 1.7.5.1 I tried to install PHP intl extension on my local server in order to use Prestashop. I added extension=php_intl.so to etc/php.ini When I try to install Prestashop I get Intl extension is not loaded . $ php -m | grep intl When I do $ php -m | grep intl , I get: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/php_intl.so' - d lopen(/usr/local/lib/php/pecl/20160303/php_intl.so, 9): image not found in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303

PHP intl can convert a Gregorian date to other calendar type

烂漫一生 提交于 2019-11-30 09:37:41
问题 PHP intl can convert a Gregorian date to other calendar type. For example Gregorian to Hijri, 2017/04/11 to 1396/01/22 Or we must use external library to convert dates? 回答1: You Can Use This Method: function getDateTimeFromCalendarToFormat($format = 'yyyy-MM-dd HH:mm:ss', $time = null, $locale = 'fa_IR', $calendar = 'persian', $timeZone = 'Asia/Tehran') { if (empty($time)) { $time = new \DateTime(); } $formatter = new \IntlDateFormatter("{$locale}@calendar={$calendar}", \IntlDateFormatter:

How to get the default currency from the PHP Intl ( ICU library )

╄→гoц情女王★ 提交于 2019-11-30 07:37:44
问题 I use PHP, and like to know how I can get the default currency for a locale via the Internationalization extension (Wrapper for the ICU library)? Below is a script that explains, what and why. I need something to replace the getCurrCode() function with. $accepted_currencies = array('USD','EUR'); $locale = Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']); if( ! empty($locale)){ Locale::setDefault($locale); $currency = getCurrCode(); if( ! in_array($currency, $accepted_currencies)){

PHP 5.3 seems to be missing Intl extension by default

女生的网名这么多〃 提交于 2019-11-30 03:22:44
问题 My system is Ubuntu 12.04, PHP 5.3, and I'm trying to run some basic Intl code like this: <?php $coll = collator_create('en_US'); $result = collator_compare($coll, "string#1", "string#2"); and it outputs PHP Fatal error: Call to undefined function collator_create() Wasn't Intl extension supposed to be bundled with PHP since version 5.3? PHP was installed via apt-get with this command line (I don't use Apache): apt-get install php5 php5-cli php5-mysql php5-cgi php5-fpm php5-curl php-apc php5

Localized (short) month names using IntlDateFormatter in PHP?

旧巷老猫 提交于 2019-11-29 18:26:52
问题 On my Windows development machine, I have set the locale to ita : setlocale(LC_TIME, 'ita'); echo strftime('%b'); // dic While (I suppose, can't test right now) on a *nix system, I should use it : setlocale(LC_TIME, 'it'); If I try to set it on my Windows it doesn't work, printing Dec . It seems I can't rely on setlocale(), so I should use IntlDateFormatter as suggested by @hakre. However, I can find the constant that gives me the month name and the short one: IntlDateFormatter::NONE (integer

PHP intl can convert a Gregorian date to other calendar type

╄→尐↘猪︶ㄣ 提交于 2019-11-29 15:32:13
PHP intl can convert a Gregorian date to other calendar type. For example Gregorian to Hijri, 2017/04/11 to 1396/01/22 Or we must use external library to convert dates? You Can Use This Method: function getDateTimeFromCalendarToFormat($format = 'yyyy-MM-dd HH:mm:ss', $time = null, $locale = 'fa_IR', $calendar = 'persian', $timeZone = 'Asia/Tehran') { if (empty($time)) { $time = new \DateTime(); } $formatter = new \IntlDateFormatter("{$locale}@calendar={$calendar}", \IntlDateFormatter::FULL, \IntlDateFormatter::FULL, $timeZone, \IntlDateFormatter::TRADITIONAL); $dateArray = []; $formatter-