matlab 整数除法函数
Given two numbers and we have to find their division in PHP.
给定两个数字,我们必须在PHP中找到它们的划分。
To find an integer division of two numbers in PHP, we can use intdiv() function, it accepts dividend and divisor and returns the result as an integer.
要在PHP中找到两个数字的整数除法 ,可以使用intdiv()函数 ,该函数接受被除数和除数,然后将结果作为整数返回。
Syntax:
句法:
intdiv(divident, divisor);
Example:
例:
Input:
$a = 10;
$b = 3;
Function call:
intdiv($a, $b);
Output:
3
PHP中的intdiv()示例 (intdiv() example in PHP)
Here we are finding the division using two ways 1) divident/divisor – the result is a float value and 2) intdiv(dividend, divisor) – the result is an integer value.
在这里,我们使用两种方法找到除法:1) 除法/除数 –结果为浮点值; 2) intdiv(除法,除数) –结果为整数值。
<?php
$a = 10;
$b = 3;
//normal division
$result1 = $a/$b;
print("value of result1: $result1 \n");
print("var_dump: ");
var_dump($result1);
print("\n");
//using intdiv() function
$result2 = intdiv($a, $b);
print("value of result2: $result2 \n");
print("var_dump: ");
var_dump($result2);
print("\n");
?>
Output
输出量
value of result1: 3.3333333333333
var_dump: float(3.3333333333333)
value of result2: 3
var_dump: int(3)
翻译自: https://www.includehelp.com/php/find-integer-division-using-intdiv-function.aspx
matlab 整数除法函数