Example: 

```
$difference = strtotime($to) - strtotime($from);
$months = ($difference / 86400 / 30 );

```

Problem: But this way I never get exact average. Because I can’t sure for 30 days there can be 31 and 28 days months also.

Even I tried to divide by 12 month average but that also can’t work in every month selection cases
read first and
change according to ur own