在PHP中查找数字的倍数 [英] Find multiples of a number in PHP
本文介绍了在PHP中查找数字的倍数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在PHP中找到一个数字的所有多重性.
I want to find all muliples of a number in PHP.
我正在使用类似的东西
if($count != 20 )
计算$count
不等于20的情况.
to work out if $count
is not equal to 20.
但是我还需要此脚本来检查$count
是否不等于20、40、60、80、100、120、140、160等.
But I also need this script to check if $count
is not equal to 20, 40, 60, 80, 100, 120, 140, 160 etc.
有什么想法吗?我想我需要使用模数符号(%
),但我不知道.
Any ideas? I think i need to use the modulus symbol (%
), but I don't know.
推荐答案
if ($count % 20 != 0)
这篇关于在PHP中查找数字的倍数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文