1

I've encountered the oddest thing today and I'm not sure what to make of it.

Here's my code:

<?php 
$nf = new \NumberFormatter("en_UK", \NumberFormatter::ORDINAL);
die(var_dump($nf->format(1)));

This code outputs the following in PHP version 5.6.20:

string(3) "1st"

but it outputs the following in PHP version 5.6.14:

string(6) "1ˢᵗ"

I'm not sure what to make of this. The superscripted version is something I was not expecting. I went through the change logs but haven't seen this change documented. Anyone know if this is intended behaviour? Any way to force it back to the first behaviour (because it looks odd when rendering it in forms)?

The PHP 5.6.20 installation is using ICU version 4.8.1.1 while 5.6.14 is using ICU version 4.4.0.1

4

1 回答 1

1

我只是升级到一个新的ICU。

奇怪的上标已在CLDR 2.0中修复它是几年前在这张票中引入的。我不确定是哪个 CLDR 版本介绍了它,但不幸的是,我的名字是审稿人。也许在当时这似乎是个好主意。

这是来自CLDR的数据而不是代码,通常我们不会为每个数据更改创建更改日志条目。

于 2016-07-19T21:29:12.393 回答