How do I check if a number is a multiple of another using PHP?

  • Thread starter Thread starter HiFi
  • Start date Start date
H

HiFi

Guest
If I have a number which I specify, is there a PHP script that can tell me if this number is a multiple of a preset number.

Example:

I want to see if a number I type into a text box is a multiple of 4. Say I type in 3. This is not a multiple of 4. I want the script to tell me that this is not a multiple of 4.

I need to find this out because I (in case people have not read by now) am creating a store. The way I am doing it is purely in PHP:

1) because I have no idea how to use MySQL and
2) it is helping me to learn more PHP

The delivery price for a product goes up in groups of 4. So, say delivery is £10 for 4. That means that delivery for 8 is £20, for 12 is £30, etc. Delivery for 7 would £20 and delivery for 9 would be £30. I already have the script to work out the cost of the actual product, but how do I do it for the delivery?

Thanks in advance.
 
Back
Top