php - PHP:为什么标志 SORT_LOCALE_STRING 没有按预期工作?
问题描述
我的代码 - 简短易懂:
setlocale(LC_ALL,'de_DE');
$tosort = ["Österreich","Indien","Deutschland","Vereinigtes Königreich","Zimbabwe"];
asort($tosort,SORT_LOCALE_STRING);
var_dump($tosort);
结果:
数组(5){ [2]=> 字符串(11)“德国”[1]=> 字符串(6)“印度”[3]=> 字符串(23)“Vereinigtes Königreich”[4]=> 字符串(8 ) "津巴布韦" [0]=> 字符串(11) "Österreich" }
预期结果:
数组(5){ [2]=> 字符串(11)“德国”[1]=> 字符串(6)“印度”[3]=> 字符串(11)“Österreich”[4]=> 字符串(23) "Vereinigtes Königreich" [0]=> string(8) "津巴布韦" }
文档: http: //php.net/manual/de/function.sort.php
问题:字符串没有在本地排序,即使我在排序之前专门做了 setlocale。这里出了什么问题,我该如何解决?预计 Ö 变音符号将直接出现在字母表中的 O 之间。这里可能出了什么问题?
解决方案
推荐阅读
- apache-kafka - 有没有办法将chrome历史日志发送到kafka?
- java - Jbpm 7.39 故障
- groovy - jMeter JSR223PostProcessor - 使用脚本运行文件 - 相对路径
- c# - IStringLocalizer 注入.Net Core 2.2
- reactjs - 无法在我的组件中使用来自 redux-form 的数据
- javascript - 使用 axios 在发布请求中传递 ReactJS 状态数据时如何解决问题?
- java - Java:Drag&Drop:从 DropTargetDropEvent 将数据返回到主类
- python-3.x - 你如何创建一个函数来返回它在 python 3 中被调用的行号?
- docker - 如何检查 IBM 容器注册表中是否存在特定的 Docker 映像
- hibernate - 最大连接池