Ingus Graholskis Ingus Graholskis - 2 years ago 96
PHP Question

How to generate numbers list starting from 3

I have this PHP code

What this code do is matching month count to numbers .

If condition is true echo result!

Result is displayed in table for each user.
$isT is count of months between 2 dates example 1,2,3 or 9

OR $isT=='6'
OR $isT=='9'
OR $isT=='12'
OR $isT=='15'
OR $isT=='18'
OR $isT=='21'){
//echo something

What i want is make this numbers automatically generated

So it would be like:

//echo something

i need numbers in this order 3 6 9 12 15. ..

basically +3 to the last number

Answer Source

As i said modulus (%) is needed here:-

if(!empty($isT) && ($isT % 3) == 0)){

//echo something


Note:- this code will check:-

1.Your variable is set

2.Have some value

3.Is a multiple of 3.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download