无需言 做自己 业 ,精于勤 荒于嬉.
- Math 函数 log 自然对数
-
发表日期:2021-07-01 08:56:07 | 来源: | 分类:Math 函数
-
log
(PHP 4, PHP 5, PHP 7, PHP 8)
log — 自然对数
说明
log(float$arg, float$base= M_E): float如果指定了可选的参数
base,log() 返回 logbasearg,否则 log() 返回参数arg的自然对数。参数
-
arg -
要计算对数的值
-
base -
The optional logarithmic base to use (defaults to 'e' and so to the natural logarithm).
返回值
返回 logbase
arg,或者它的自然对数。更新日志
版本 说明 4.3.0 可选参数 base可用。 你可以计算任意以b为底n的对数,但其实使用的是数学等式:logb(n) = log(n)/log(b),其中 log 是自然对数。 -
- Math 函数 is_nan 判断是否为合法数值
-
发表日期:2021-07-01 08:56:07 | 来源: | 分类:Math 函数
-
示例1
<?php // Invalid calculation, will return a // NaN value$nan = acos(8); var_dump($nan, is_nan($nan)); ?>
- Math 函数 max 找出最大值
-
发表日期:2021-07-01 08:56:07 | 来源: | 分类:Math 函数
-
示例1
<?php echo max(1, 3, 5, 6, 7); // 7echo max(array(2, 4, 5)); // 5// When 'hello' is cast as integer it will be 0. Both the parameters are equally// long, so the order they are given in determines the resultecho max(0, 'hello'); // 0echo max('hello', 0); // helloecho max('42', 3); // '42'// Here 0 > -1, so 'hello' is the return value.echo max(-1, 'hello'); // hello// With multiple arrays of different lengths, max returns the longest$val = max(array(2, 2, 2), array(1, 1, 1, 1)); // array(1, 1, 1, 1)// 对多个数组,max 从左向右比较。 // 因此在本例中:2 == 2,但 4 < 5$val = max(array(2, 4, 8), array(2, 5, 7)); // array(2, 5, 7)// 如果同时给出数组和非数组作为参数,则总是将数组视为 // 最大值返回$val = max('string', array(2, 5, 7), 42); // array(2, 5, 7)?>
- Math 函数 log10 以 10 为底的对数
-
发表日期:2021-07-01 08:56:07 | 来源: | 分类:Math 函数
-
log10
(PHP 4, PHP 5, PHP 7, PHP 8)
log10 — 以 10 为底的对数
说明
log10(float$arg): float返回参数
arg以 10 为底的对数。参数
-
arg -
要处理的参数
返回值
arg以 10 为底的对数。 -
- Math 函数 atan 反正切
-
发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数
- Math 函数 acosh 反双曲余弦
-
发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数
- Math 函数 base_convert 在任意进制之间转换数字
-
发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数
-
示例1
<?php $hexadecimal = 'A37334'; echo base_convert($hexadecimal, 16, 2); ?>
- Math 函数 bindec 二进制转换为十进制
-
发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数
-
示例1
<?php echo bindec('110011') . "\n"; echo bindec('000110011') . "\n"; echo bindec('111'); ?>示例2
<?php /* * The lesson from this example is in the output * rather than the PHP code itself. */ $magnitude_lower = pow(2, (PHP_INT_SIZE * 8) - 2); p($magnitude_lower - 1); p($magnitude_lower, 'See the rollover? Watch it next time around...'); p(PHP_INT_MAX, 'PHP_INT_MAX'); p(~PHP_INT_MAX, 'interpreted to be one more than PHP_INT_MAX'); if (PHP_INT_SIZE == 4) { $note = 'interpreted to be the largest unsigned integer'; } else { $note = 'interpreted to be the largest unsigned integer (18446744073709551615) but skewed by float precision'; } p(-1, $note); function p($input, $note = '') { echo "input: $input\n"; $format = '%0' . (PHP_INT_SIZE * 8) . 'b'; $bin = sprintf($format, $input); echo "binary: $bin\n"; ini_set('precision', 20); // For readability on 64 bit boxes. $dec = bindec($bin); echo 'bindec(): ' . $dec . "\n"; if ($note) { echo "NOTE: $note\n"; } echo "\n"; } ?>
- Math 函数 acos 反余弦
-
发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数
- Math 函数 abs 绝对值
-
发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数
-
示例1
<?php $abs = abs(-4.2); // $abs = 4.2; (double/float)$abs2 = abs(5); // $abs2 = 5; (integer)$abs3 = abs(-5); // $abs3 = 5; (integer)?>
- Math 函数 dechex 十进制转换为十六进制
-
发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数
-
示例1
<?php echo dechex(10) . "\n"; echo dechex(47); ?>
示例2
<?php // The output below assumes a 32-bit platform.// Note that the output is the same for all values.echo dechex(-1)."\n"; echo dechex(PHP_INT_MAX * 2 + 1)."\n"; echo dechex(pow(2, 32) - 1)."\n"; ?>
- Math 函数 atanh 反双曲正切
-
发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数
- Math 函数 decbin 十进制转换为二进制
-
发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数
-
示例1
<?php echo decbin(12) . "\n"; echo decbin(26); ?>
- Math 函数 cosh 双曲余弦
-
发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数
- Math 函数 deg2rad 将角度转换为弧度
-
发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数
-
示例1
<?php echo deg2rad(45); // 0.785398163397var_dump(deg2rad(45) === M_PI_4); // bool(true)?>
- Math 函数 exp 计算 e 的指数
-
发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数
-
示例1
<?php echo exp(12) . "\n"; echo exp(5.7); ?>
- Math 函数 cos 余弦
-
发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数
-
示例1
<?php echo cos(M_PI); // -1?>
- Math 函数 expm1 返回 exp(number) - 1,甚至当 number 的值接近零也能计算出准确结果
-
发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数
-
expm1
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
expm1 — 返回 exp(number) - 1,甚至当 number 的值接近零也能计算出准确结果
说明
expm1(float$arg): floatexpm1() 返回 'exp(
number) - 1',甚至当number的值接近零也能计算出准确结果。但是当两个数值趋近于相等的时候, 'exp (number) - 1' 就会变得不太准确。参数
-
arg -
要处理的参数
返回值
'e' to the power of
argminus one更新日志
版本 说明 5.3.0 此函数在所有平台上均可用 -
- Math 函数 decoct 十进制转换为八进制
-
发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数
-
示例1
<?php echo decoct(15) . "\n"; echo decoct(264); ?>
- Math 函数 fdiv Divides two numbers, according to IEEE 754
-
发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数
-
示例1
<?php var_dump(fdiv(5.7, 1.3)); // float(4.384615384615385)var_dump(fdiv(4, 2)); // float(2)var_dump(fdiv(1.0, 0.0)); // float(INF)var_dump(fdiv(-1.0, 0.0)); // float(-INF)var_dump(fdiv(0.0, 0.0)); // float(NAN)?>
- 前端开发(1)
- 数据库(0)
- PHP(0)
- PHP杂项(34)
- PHP基础-李炎恢系列课程(20)
- 中文函数手册(0)
- 错误处理 函数(13)
- OPcache 函数(6)
- PHP 选项/信息 函数(54)
- Zip 函数(10)
- Hash 函数(15)
- OpenSSL 函数(63)
- Date/Time 函数(51)
- 目录函数(9)
- Fileinfo 函数(6)
- iconv 函数(11)
- 文件系统函数(81)
- 多字节字符串 函数(57)
- GD 和图像处理 函数(114)
- 可交换图像信息(5)
- Math 函数(50)
- 程序执行函数(11)
- PCNTL 函数(23)
- JSON 函数(4)
- SPL 函数(15)
- URL 函数(10)
- cURL 函数(32)
- 网络 函数(33)
- FTP 函数(36)
- Session 函数(23)
- PCRE 函数(11)
- PCRE 正则语法(19)
- 数组 函数(81)
- 类/对象 函数(18)
- 函数处理 函数(13)
- 变量处理 函数(37)
- SimpleXML 函数(3)
- 杂项 函数(31)
- 字符串 函数(101)
- JAVA(0)
- Android(0)
- Linux(0)
- AI大模型(9)
- 其他(0)
宁公网安备 64010402001209号