Find multiples of a number in PHP

前端 未结 4 1070
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-08 13:52

I want to find all muliples of a number in PHP.

I\'m using something like this

if($count != 20 )

to work out if $count

相关标签:
4条回答
  • 2020-12-08 14:29

    You can do it like so:

    if($count % 20 != 0)
    
    0 讨论(0)
  • 2020-12-08 14:30

    If you don't want zero to be excluded:

    if ($count % 20 != 0 || $count == 0)
    
    0 讨论(0)
  • 2020-12-08 14:33
    if ($count % 20 != 0)
    
    0 讨论(0)
  • 2020-12-08 14:43
    if ($count % 20 != 0)
    {
      // $count is not a multiple of 20
    }
    
    0 讨论(0)
提交回复
热议问题