学习:PHP中文函数(3)

http://www.itjxue.com  2015-07-17 08:20  来源:未知  点击次数: 

 

函数uasort()
描述:
以自定义的方式排列一个数组且序列不变。


函数uksort()
描述:
以自定义的方式以key排列
This function will sort the keys of an array using a user-supplied comparison function. If the array you wish to sort needs to be sorted by some non-trivial criteria, you should use this function. Example 1. uksort() example

function mycompare($a, $b) {
if ($a == $b) return 0;
return ($a > $b) ? -1 : 1;
}
$a = array(4 => "four", 3 => "three", 20 => "twenty", 10 => "ten");
uksort($a, mycompare);
while(list($key, $value) = each($a)) {
echo "$key: $value\n";
}


This example would display: 20: twenty 10: ten 4: four 3: three

函数usort()
描述:
以自定义的方式以value排列


void usort (array array, function cmp_function);


This function will sort an array by its values using a user-supplied comparison function. If the array you wish to sort needs to be sorted by some non-trivial criteria, you should use this function. Example 1. usort() example


function cmp($a,$b) {
if ($a == $b) return 0;
return ($a > $b) ? -1 : 1;
}
$a = array(3,2,5,6,1);
usort($a, cmp);
while(list($key,$value) = each($a)) {
echo "$key: $value\n";
}



This example would display: 0: 6 1: 5 2: 3 3: 2 4: 1 Obviously in this trivial case the rsort() function would be more appropriate.

BC (Arbitrary Precision) Functions


 

函数bcadd()
描述:
Add two arbitrary precision numbers
string bcadd (string left operand, string right operand, int [ scale ]); 左面的字符加右面的字符,返回一个字符。


 

函数bccomp()
描述:
int bccomp (string left operand, string right operand, int [ scale ]);
左面的字符和右面的字符进行比较,如果相等的话返回0,如果左面的比右面的长返回+1,右面的比左面的长返回-1


 

函数bcdiv()
描述:
Divide two arbitrary precision numbers
string bcdiv (string left operand, string right operand, int [ scale ]); 将左面的字符串以右面的字符串为标准分开


 

函数bcmod()
描述:
Get modulus of an arbitrary precision number
string bcmod (string left operand, string modulus);
用右面的modulus操作左面的字符串


 

函数bcmul()
描述:
Multiply two arbitrary precision number
string bcmul (string left operand, string right operand, int [ scale ]);
Multiply the left operand by the right operand and returns the result. The optional scale sets the number of digits
after the decimal place in the result.


 

函数bcpow()
描述:
Raise an arbitrary precision number to another.
Raise x to the power y . The scale can be used to set the number of digits after the decimal place in the result.


 

函数bcscale()
描述:
Set default scale parameter for all bc math functions.
string bcscale (int scale);
This function sets the default scale parameter for all subsequent bc math functions that do not explicitly specify a scale
parameter


 

函数bcsqrt()
描述;
string bcsqrt (string operand, int scale);
返回字符的平方根


 

函数bcsub()
描述:
string bcsub (string left operand, string right operand, int [ scale ]);
将右面的字符减去左面的字符


 

Calendar Functions日历功能


 

函数JDToGregorian()
描述:
string jdtogregorian (int julianday);
将Julian日历转换成Gregorian日历


 

函数GregorianToJD()
描述:
int gregoriantojd (int month, int day, int year);
将Gregorian日历转换成Julian日历


 

函数JDToJulian ()
描述:
string jdtojulian (int julianday);
将Julian Calendar转换Julian Day


 

函数JulianToJD ()
描述:
int juliantojd (int month, int day, int year);


 

函数JDToJewish ()
描述:
Converts a Julian Day Count to the Jewish Calendar
string jdtojewish (int julianday);


 

函数JewishToJD()
描述:
Converts a date in the Jewish Calendar to Julian Day Count
int jewishtojd (int month, int day, int year);


 

函数JDToFrench()
描述:
Converts a Julian Day Count to the French Republican Calendar
string jdtofrench (int month, int day, int year);


 

函数FrenchToJD()
描述:
Converts a date from the French Republican Calendar to a Julian Day Count int frenchtojd (int month, int day, int year);

函数JDMonthName ()
描述:
Returns a month name
string jdmonthname (int julianday, int mode);
Mode Meaning
0 Gregorian - apreviated
1 Gregorian
2 Julian - apreviated
3 Julian
4 Jewish
5 French Republican

函数JDDayOfWeek ()
描述:
Returns the day of the week
mixed jddayofweek (int julianday, int mode);
Mode Meaning
0 returns the day number as an int (0=sunday, 1=monday, etc)
1 returns string containing the day of week (english-gregorian)
2 returns a string containing the abreviated day of week (english-gregorian)

(责任编辑:IT教学网)

更多