How to implement judgment of integer division in PHP

藏色散人
Release: 2023-03-02 06:10:02
Original
5617 people have browsed it

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);
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template