Home >Backend Development >PHP Problem >How to implement judgment of integer division in PHP

How to implement judgment of integer division in PHP

藏色散人
藏色散人Original
2020-07-06 10:58:065637browse

php implementation method for determining integer division: first create a PHP code sample file; then use the "%" operator to determine whether the result of dividing two numbers is 0. If the result is 0, it means that it can be divided into integers; finally execute this Just file.

How to implement judgment of integer division in PHP

php determines whether two numbers are divisible:

function zhengchu(m,n){
    if(m%n == 0){//取余  若结果为0代表能够整除
    echo "能够整除";
    }else{
    echo "不能整除";
    }
}
//测试
zhengchu(10,3);

For more related knowledge, please visit PHP Chinese website!

The above is the detailed content of How to implement judgment of integer division in PHP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn