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

How to implement integer division judgment in php

藏色散人
Release: 2023-03-02 11:14:01
Original
5387 people have browsed it

How to implement php integer division judgment: first create a php sample file; then define a variable; finally, judge whether the result is divisible according to the remainder operation, and the judgment statement is "if (! ($a % 5) && $a)".

How to implement integer division judgment in php

php method to determine divisibility:

Method 1: Judgment based on remainder operation

$a = 5
if (!($a % 5) && $a)
    echo $a."可以被5整除";
Copy after login

Method 2:

It’s OK to directly take the remainder to 0, $a%5==0.

For more related knowledge, please visit PHP Chinese website!

The above is the detailed content of How to implement integer division judgment 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