matlab 整数除法函数_PHP程序使用intdiv()函数查找整数除法

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 整数除法函数

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值