PHP正确的使用复数
1 <?php 2 // 正确地显示复数 3 if(!function_exists('_plurals_format')) 4 { 5 /** 6 * 正确的使用复数 7 * @access public 8 * @author zhaoyingnan 2016-02-17 11:53 9 * @param string $sPluralName 非复数形式的名称 10 * @param int $iAmount 数量 11 * @return string 12 * @note 13 **/ 14 function _plurals_format($sPluralName, $iAmount) 15 { 16 if(!$sPluralName || !is_numeric($iAmount) || $iAmount <= 0) 17 return ''; 18 // 特殊的复数形式 19 $arPluralName = array( 20 'addendum'=>'addenda', 21 'alga'=>'algae', 22 'alumna'=>'alumnae', 23 'alumnus'=>'alumni', 24 'analysis'=>'analyses', 25 'antenna'=>'antennas',//antennae 26 'apparatus'=>'apparatuses', 27 'appendix'=>'appendices',//appendixes 28 'axis'=>'axes', 29 'bacillus'=>'bacilli', 30 'bacterium'=>'bacteria', 31 'basis'=>'bases', 32 'beau'=>'beaux', 33 'bison'=>'bison', 34 'buffalo'=>'buffalos',//buffaloes 35 'bureau'=>'bureaus', 36 'bus'=>'busses',//buses 37 'cactus'=>'cactuses',//cacti 38 'calf'=>'calves', 39 'child'=>'children', 40 'corps'=>'corps', 41 'corpus'=>'corpora',//corpuses 42 'crisis'=>'crises', 43 'criterion'=>'criteria', 44 'curriculum'=>'curricula', 45 'datum'=>'data', 46 'deer'=>'deer', 47 'die'=>'dice', 48 'dwarf'=>'dwarfs',//dwarves 49 'diagnosis'=>'diagnoses', 50 'echo'=>'echoes', 51 'elf'=>'elves', 52 'ellipsis'=>'ellipses', 53 'embargo'=>'embargoes', 54 'emphasis'=>'emphases', 55 'erratum'=>'errata', 56 'fireman'=>'firemen', 57 'fish'=>'fish',//fishes 58 'focus'=>'focuses', 59 'foot'=>'feet', 60 'formula'=>'formulas', 61 'fungus'=>'fungi',//funguses 62 'genus'=>'genera', 63 'goose'=>'geese', 64 'half'=>'halves', 65 'hero'=>'heroes', 66 'hippopotamus'=>'hippopotami',//hippopotamuses 67 'hoof'=>'hoofs',//hooves 68 'hypothesis'=>'hypotheses', 69 'index'=>'indices',//indexes 70 'knife'=>'knives', 71 'leaf'=>'leaves', 72 'life'=>'lives', 73 'loaf'=>'loaves', 74 'louse'=>'lice', 75 'man'=>'men', 76 'matrix'=>'matrices', 77 'means'=>'means', 78 'medium'=>'media', 79 'memorandum'=>'memoranda', 80 'millennium'=>'millenniums',//milennia 81 'moose'=>'moose', 82 'mosquito'=>'mosquitoes', 83 'mouse'=>'mice', 84 'nebula'=>'nebulae',//nebulas 85 'neurosis'=>'neuroses', 86 'nucleus'=>'nuclei', 87 'oasis'=>'oases', 88 'octopus'=>'octopi',//octopuses 89 'ovum'=>'ova', 90 'ox'=>'oxen', 91 'paralysis'=>'paralyses', 92 'parenthesis'=>'parentheses', 93 'person'=>'people', 94 'phenomenon'=>'phenomena', 95 'potato'=>'potatoes', 96 'radius'=>'radii',//radiuses 97 'scarf'=>'scarfs',//scarves 98 'self'=>'selves', 99 'series'=>'series', 100 'sheep'=>'sheep', 101 'shelf'=>'shelves', 102 'scissors'=>'scissors', 103 'species'=>'species', 104 'stimulus'=>'stimuli', 105 'stratum'=>'strata', 106 'syllabus'=>'syllabi',//syllabuses 107 'symposium'=>'symposia',//symposiums 108 'synthesis'=>'syntheses', 109 'synopsis'=>'synopses', 110 'tableau'=>'tableaux', 111 'that'=>'those', 112 'thesis'=>'theses', 113 'thief'=>'thieves', 114 'this'=>'these', 115 'tomato'=>'tomatoes', 116 'tooth'=>'teeth', 117 'torpedo'=>'torpedoes', 118 'vertebra'=>'vertebrae', 119 'veto'=>'vetoes', 120 'vita'=>'vitae', 121 'watch'=>'watches', 122 'wife'=>'wives', 123 'wolf'=>'wolves', 124 'woman'=>'women', 125 'zero'=>'zeros',//zeroes 126 ); 127 128 // 如果只有一个 129 if($iAmount == 1) 130 return $sPluralName; 131 132 // 如果超过一个,并且是特殊的复数形式 133 if(isset($arPluralName[$sPluralName])) 134 return $arPluralName[$sPluralName]; 135 136 // 超过一个,并且是一个标准的复数形式 137 return $sPluralName.'s'; 138 } 139 } 140 141 echo 'Sybil ate three '._plurals_format('biscuit', 3).', one after the other.',PHP_EOL; 142 echo 'The two '._plurals_format('woman', 2).' will meet tomorrow in the final.';
转载于:https://www.cnblogs.com/yingnan/p/5194817.html
PHP正确的使用复数相关推荐
- matlab中的数值计算,MATLAB数值计算(中译本,最新修订)
章MATLAB入门 1.1黄金分割比 1.2斐波那契数 1.3分形蕨 1.4魔方矩阵 1.5密码技术 1.6数论问题3n+1序列 1.7浮点运算 1.8更多阅读 习题 第2章线性方程 2.1解线性方程 ...
- [渝粤题库]西北工业大学复变函数与积分变换
复变函数与积分变换 窗体顶端 1. 下列关于幂级数的叙述,不正确的是( ). A.在收敛圆内,幂级数绝对收敛 B.在收敛圆外,幂级数发散 C.在收敛圆周上,可能收敛,也可能发散 D.在收敛圆 ...
- Linux无网络升级gcc,Linux离线(手动)升级GCC
本文介绍在系统无法连接互联网的情况下,如何升级GCC.离线和在线升级的主要区别在于,如果可以联网,在升级gcc前的需要安装的依赖包,可以通过运行gcc安装包下的脚本自行下载安装,免去了很多的麻烦. 当 ...
- Visual Question Answering: Datasets, Algorithms, and Future Challenges文章翻译
Abstract 视觉问答(VQA)是计算机视觉和自然语言处理领域的一个新问题,引起了深度学习.计算机视觉和自然语言处理领域的极大兴趣.在VQA,一种算法需要回答基于文本的图像问题.自2014年第一个 ...
- Unix编程/应用问答中文版(转)
Unix编程/应用问答中文版 名称 -- Unix编程/应用问答中文版 版本 -- 0.04 ( 2003-10-09 外发版 ) 维护 -- 小四 <scz@nsfocus.com> 主 ...
- GNU Make 使用手册(中译版)
如果要全面了解Linux的结构.理解Linux的编程总体设计及思想必须首先全部读通Linux源代码中各级的Makefile文件.目前,在网上虽然有一些著作,但都不能全面的解释Linux源代码中各级的M ...
- 关于python中的复数、下列说法正确的是_关于Python中的复数,下列说法正确的是?...
关于Python中的复数,下列说法正确的是? 答:表示复数的语法是real + image j 实部和虚部都是浮点数 方法conjugate返回复数的共轭复数 中国大学MOOC: 依据年龄和死亡率之间 ...
- python中正确的输入语句x、y=input_语句x=input()执行时,如果从键盘输入12并按回车键,则x的值是( )。_学小易找答案...
[多选题]听障儿童辨音训练包括( ) [简答题]实现栈类(顺序栈跟链栈均可),并利用栈实现十进制到二进制的转换. 将源代码.py文件作为附件上传. [简答题]什么是空字典和空集合?如何创建 [简答题] ...
- 如何正确使用as follows 与 following
转载自:http://blog.sina.com.cn/s/blog_4ac340b801000c0e.html~type=v5_one&label=rela_prevarticle Li ...
- 常用jar包_发布Maven包的正确姿势
本文介绍如何把自己写的Maven包发布到公开仓库/中央仓库/私有仓库. 当我们使用commons-logging这些第三方开源库的时候,我们实际上是通过Maven自动下载它的jar包,并根据其pom. ...
最新文章
- mnn c++ windows 调用实例
- Linux简介、什么是Linux
- Dijkstra算法实现
- elasticsearch 的查询 /_nodes/stats 各字段意思
- 前端vue实现pdf文件的在线预览
- 你的消息队列如何保证消息不丢失,且只被消费一次,这篇就教会你
- WordPress主题modown6.2+erphpdown11.7
- 开源漏洞扫描工具(OWASP-Dependency-Check)探索
- Visual Studio 2019 v16.4 Preview 2 发布
- MySQL5.7默认打开ONLY_FULL_GROUP_BY模式问题与解决方案
- python.集合转列表_Python列表、元组、字典、集合
- mysql数据库笔记 约束_MySQL数据库笔记四:MySQL的约束
- 【安安教具】-【工具】-【随机点名】模拟器 教你如何用python制作随机点名器
- Dorado7常用JS以及常见错误
- Ionic3 Demo
- 用angular JS和 bootstrap完成一个简单的购物车界面
- ent orm笔记2---schema使用(上)
- TF-A中的工具介绍
- 解决Cookie乱码问题
- 腾讯朋友圈广告的优势有哪些?如何代理腾讯朋友圈广告?