<?php
// 正确地显示复数
if(!function_exists('_plurals_format'))
{
/**
* 正确的使用复数
* @access public
* @author zhaoyingnan 2016-02-17 11:53
* @param string $sPluralName 非复数形式的名称
* @param int $iAmount 数量
* @return string
* @note
**/
function _plurals_format($sPluralName, $iAmount)
{
if(!$sPluralName || !is_numeric($iAmount) || $iAmount <= 0)
return '';
// 特殊的复数形式
$arPluralName = array(
'addendum'=>'addenda',
'alga'=>'algae',
'alumna'=>'alumnae',
'alumnus'=>'alumni',
'analysis'=>'analyses',
'antenna'=>'antennas',//antennae
'apparatus'=>'apparatuses',
'appendix'=>'appendices',//appendixes
'axis'=>'axes',
'bacillus'=>'bacilli',
'bacterium'=>'bacteria',
'basis'=>'bases',
'beau'=>'beaux',
'bison'=>'bison',
'buffalo'=>'buffalos',//buffaloes
'bureau'=>'bureaus',
'bus'=>'busses',//buses
'cactus'=>'cactuses',//cacti
'calf'=>'calves',
'child'=>'children',
'corps'=>'corps',
'corpus'=>'corpora',//corpuses
'crisis'=>'crises',
'criterion'=>'criteria',
'curriculum'=>'curricula',
'datum'=>'data',
'deer'=>'deer',
'die'=>'dice',
'dwarf'=>'dwarfs',//dwarves
'diagnosis'=>'diagnoses',
'echo'=>'echoes',
'elf'=>'elves',
'ellipsis'=>'ellipses',
'embargo'=>'embargoes',
'emphasis'=>'emphases',
'erratum'=>'errata',
'fireman'=>'firemen',
'fish'=>'fish',//fishes
'focus'=>'focuses',
'foot'=>'feet',
'formula'=>'formulas',
'fungus'=>'fungi',//funguses
'genus'=>'genera',
'goose'=>'geese',
'half'=>'halves',
'hero'=>'heroes',
'hippopotamus'=>'hippopotami',//hippopotamuses
'hoof'=>'hoofs',//hooves
'hypothesis'=>'hypotheses',
'index'=>'indices',//indexes
'knife'=>'knives',
'leaf'=>'leaves',
'life'=>'lives',
'loaf'=>'loaves',
'louse'=>'lice',
'man'=>'men',
'matrix'=>'matrices',
'means'=>'means',
'medium'=>'media',
'memorandum'=>'memoranda',
'millennium'=>'millenniums',//milennia
'moose'=>'moose',
'mosquito'=>'mosquitoes',
'mouse'=>'mice',
'nebula'=>'nebulae',//nebulas
'neurosis'=>'neuroses',
'nucleus'=>'nuclei',
'oasis'=>'oases',
'octopus'=>'octopi',//octopuses
'ovum'=>'ova',
'ox'=>'oxen',
'paralysis'=>'paralyses',
'parenthesis'=>'parentheses',
'person'=>'people',
'phenomenon'=>'phenomena',
'potato'=>'potatoes',
'radius'=>'radii',//radiuses
'scarf'=>'scarfs',//scarves
'self'=>'selves',
'series'=>'series',
'sheep'=>'sheep',
'shelf'=>'shelves',
'scissors'=>'scissors',
'species'=>'species',
'stimulus'=>'stimuli',
'stratum'=>'strata',
'syllabus'=>'syllabi',//syllabuses
'symposium'=>'symposia',//symposiums
'synthesis'=>'syntheses',
'synopsis'=>'synopses',
'tableau'=>'tableaux',
'that'=>'those',
'thesis'=>'theses',
'thief'=>'thieves',
'this'=>'these',
'tomato'=>'tomatoes',
'tooth'=>'teeth',
'torpedo'=>'torpedoes',
'vertebra'=>'vertebrae',
'veto'=>'vetoes',
'vita'=>'vitae',
'watch'=>'watches',
'wife'=>'wives',
'wolf'=>'wolves',
'woman'=>'women',
'zero'=>'zeros',//zeroes
); // 如果只有一个
if($iAmount == 1)
return $sPluralName; // 如果超过一个,并且是特殊的复数形式
if(isset($arPluralName[$sPluralName]))
return $arPluralName[$sPluralName]; // 超过一个,并且是一个标准的复数形式
return $sPluralName.'s';
}
} echo 'Sybil ate three '._plurals_format('biscuit', 3).', one after the other.',PHP_EOL;
echo 'The two '._plurals_format('woman', 2).' will meet tomorrow in the final.';

PHP正确的使用复数的更多相关文章

  1. rails日记1

    assert_select "div" <div>foobar</div>assert_select "div", "foob ...

  2. MATLAB的基本元素

    MALTAB程序的基本数据单元是数组,MATLAB 的变量名必须以字母开头,后面可以跟字母,数字和下划线(_).只有前31个字符是有效的:如果超过了31 个字符,基余的字符将被忽略.如果声明两个变量, ...

  3. java 实现傅立叶变换算法 及复数的运算

    最近项目需求,需要把python中的算法移植到java上,其中有一部分需要用到复数的运算和傅立叶变换算法,废话不多说 如下: package qrs; /** * 复数的运算 * */ public ...

  4. in+sb's+基数词的复数形式|UFO|the minutes|

    Hawking became world-famous in ________.  A. his thirties in the 1970's  B. the thirties in his 1970 ...

  5. 利用JavaScript与正则表达式判断输入账号格式是否正确

    在学习了HTML DOM对象后,做几个小练习来巩固一下所学内容. 正则表达式: 正则表达式,又称规则表达式.(英语:Regular Expression,在代码中常简写为regex.regexp或RE ...

  6. Git 在团队中的最佳实践--如何正确使用Git Flow

    我们已经从SVN 切换到Git很多年了,现在几乎所有的项目都在使用Github管理, 本篇文章讲一下为什么使用Git, 以及如何在团队中正确使用. Git的优点 Git的优点很多,但是这里只列出我认为 ...

  7. 如何正确使用日志Log

    title: 如何正确使用日志Log date: 2015-01-08 12:54:46 categories: [Python] tags: [Python,log] --- 文章首发地址:http ...

  8. WebAPi之SelfHost自创建证书启动Https疑难解惑及无法正确返回结果

    前言 话说又来需求了,之前对于在SelfHost中需要嵌套页面并操作为非正常需求,这回来正常需求了,客户端现在加了https,老大过来说WebAPi访问不了了,这是什么情况,我去试了试,还真是这个情况 ...

  9. javascript匹配各种括号书写是否正确

    今天在codewars上做了一道题,如下 看上去就是验证三种括号各种嵌套是否正确书写,本来一头雾水,一种括号很容易判断, 但是三种怎么判断! 本人只是个前端菜鸟,,不会什么高深的正则之类的. 于是,在 ...

随机推荐

  1. GJM:用C#实现网络爬虫(二) [转载]

    上一篇<用C#实现网络爬虫(一)>我们实现了网络通信的部分,接下来继续讨论爬虫的实现 3. 保存页面文件 这一部分可简单可复杂,如果只要简单地把HTML代码全部保存下来的话,直接存文件就行 ...

  2. NProgress.js template

    NProgress.js:加载进度条:http://ricostacruz.com/nprogress/ 基础的这几个方法 这个网站上都有 我在一个地方看到这个代码 NProgress.configu ...

  3. sass的四种css编译风格

    sass的改变编译风格的语句: sass style expanded assets/sass/style1.sass:assets/css/style1.css 1.nested:默认 #main ...

  4. ALV中处理过滤掉的行

    有时候我们在ALV的时候,客户会对输出的数据进行二次筛选,这时候如果我们做全选(checkbox)系统会把我们过滤掉得数据也选择: 用下面的method就可避免此问题: DATA:it_rows TY ...

  5. ABAP中的数据校验-备注

    通过 function module 检查日期是否合法(DDUT_INPUT_CHECK的校验会根据账户的时间设置格式)     日期校验方式一: CALL FUNCTION ‘DATE_CHECK_ ...

  6. SharePoint 2013 日历视图兼容性问题

    在IE11上访问SharePoint 2013 calendar视图,发现加入兼容性视图以后访问,正常,如下图: 不加入兼容性视图IE11访问,出现兼容性问题,如下图: 因为有些环境有问题,有些环境没 ...

  7. java连接hbase报错

    报错信息如下: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the va ...

  8. Android Handler机制(一)---Message源码分析

    Message: 定义: public final class Message implements Parcelable Message类是个final类,就是说不能被继承,同时Message类实现 ...

  9. Android 采用post方式提交数据到服务器

    接着上篇<Android 采用get方式提交数据到服务器>,本文来实现采用post方式提交数据到服务器 首先对比一下get方式和post方式: 修改布局: <LinearLayout ...

  10. AFNetworking简单用法

    GET请求 AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; [manager GET:URL parameters:ni ...