the results of the PHP diff function are wrong when calculating the month and day count at the web server
I calculate the month and day count between 2 dates via the PHP diff-func but i get different results when running the code offline at my dev-pc (PHP Version 5.6.8) and online at the web-server (PHP Version 7.0.24).
time period from 2018-01-01 to 2018-02-01 = 0 years, 1 months, 0 days
time period from 2018-01-01 to 2018-02-02 = 0 years, 1 months, 1 days
time period from 2018-01-01 to 2018-02-03 = 0 years, 1 months, 2 days
---
time period from 2018-02-01 to 2018-03-01 = 0 years, 1 months, 0 days
time period from 2018-02-01 to 2018-03-02 = 0 years, 1 months, 1 days
time period from 2018-02-01 to 2018-03-03 = 0 years, 1 months, 2 days
---
time period from 2018-03-01 to 2018-04-01 = 0 years, 1 months, 0 days
time period from 2018-03-01 to 2018-04-02 = 0 years, 1 months, 1 days
time period from 2018-03-01 to 2018-04-03 = 0 years, 1 months, 2 days
---
time period from 2018-04-01 to 2018-05-01 = 0 years, 1 months, 0 days
time period from 2018-04-01 to 2018-05-02 = 0 years, 1 months, 1 days
time period from 2018-04-01 to 2018-05-03 = 0 years, 1 months, 2 days
---
time period from 2018-05-01 to 2018-06-01 = 0 years, 1 months, 0 days
time period from 2018-05-01 to 2018-06-02 = 0 years, 1 months, 1 days
time period from 2018-05-01 to 2018-06-03 = 0 years, 1 months, 2 days
---
the result at the web-server (PHP Version 7.0.24):
time period from 2018-01-01 to 2018-02-01 = 0 years, 1 months, 0 days
time period from 2018-01-01 to 2018-02-02 = 0 years, 1 months, 1 days
time period from 2018-01-01 to 2018-02-03 = 0 years, 1 months, 2 days
---
time period from 2018-02-01 to 2018-03-01 = 0 years, 0 months, 28 days
time period from 2018-02-01 to 2018-03-02 = 0 years, 0 months, 29 days
time period from 2018-02-01 to 2018-03-03 = 0 years, 0 months, 30 days
---
time period from 2018-03-01 to 2018-04-01 = 0 years, 1 months, 3 days
time period from 2018-03-01 to 2018-04-02 = 0 years, 1 months, 4 days
time period from 2018-03-01 to 2018-04-03 = 0 years, 1 months, 5 days
---
time period from 2018-04-01 to 2018-05-01 = 0 years, 0 months, 30 days
time period from 2018-04-01 to 2018-05-02 = 0 years, 1 months, 0 days
time period from 2018-04-01 to 2018-05-03 = 0 years, 1 months, 1 days
---
time period from 2018-05-01 to 2018-06-01 = 0 years, 1 months, 1 days
time period from 2018-05-01 to 2018-06-02 = 0 years, 1 months, 2 days
time period from 2018-05-01 to 2018-06-03 = 0 years, 1 months, 3 days
Can anyone explain me why the web-server calculate the 2 dates wrong and how to fix this?