


How to determine whether two numbers are remainder after division in php
php method to determine whether the division is remainder: 1. Use the "%" operator to calculate the division of two numbers and obtain the remainder value. The syntax is "Number 1% Number 2"; 2. Use the if statement and " !="operator can be used to determine whether the obtained remainder value is 0, the syntax is "if (remainder value!=0){//division has remainder}else{//division has no remainder}".
The operating environment of this tutorial: Windows 7 system, PHP version 7.1, DELL G3 computer
Determine whether the division is sufficient in PHP, or It is to determine whether the remainder of the division of two numbers is 0.
So we need to first use the "%" operator to find the remainder, and then use the "!=" or "==" operator to determine whether the remainder is 0.
Implementation code:
<?php header("Content-type:text/html;charset=utf-8"); $num1 = 12; $num2 = 3; $num=$num1%$num2; if($num!=0){ echo "相除有余"; }else{ echo "相除没有余"; } ?>
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to determine whether two numbers are remainder after division in php. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Atom editor mac version download
The most popular open source editor

Dreamweaver CS6
Visual web development tools
