3v4l.org

run code in 300+ PHP versions simultaneously
<?php $end_date=mktime(23,59,59,12,31,2014); echo date("r", $end_date)."\n"; $date=strtotime("last day of -1 months", $end_date); echo date("r", $date)."\n"; $date=strtotime("last day of -2 months", $end_date); echo date("r", $date)."\n"; $date=strtotime("last day of -3 months", $end_date); echo date("r", $date)."\n"; $date=strtotime("last day of -4 months", $end_date); echo date("r", $date)."\n"; $date=strtotime("last day of -5 months", $end_date); echo date("r", $date)."\n"; $date=strtotime("last day of -6 months", $end_date); echo date("r", $date)."\n"; $date=strtotime("last day of -7 months", $end_date); echo date("r", $date)."\n"; $date=strtotime("last day of -8 months", $end_date); echo date("r", $date)."\n"; $date=strtotime("last day of -9 months", $end_date); echo date("r", $date)."\n"; $date=strtotime("last day of -10 months", $end_date); echo date("r", $date)."\n"; $date=strtotime("last day of -11 months", $end_date); echo date("r", $date)."\n"; $date=strtotime("last day of -12 months", $end_date); echo date("r", $date)."\n";
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.23, 7.4.0 - 7.4.12, 8.0.0alpha1 - rc2
Wed, 31 Dec 2014 23:59:59 +0100 Sun, 30 Nov 2014 23:59:59 +0100 Fri, 31 Oct 2014 23:59:59 +0100 Tue, 30 Sep 2014 23:59:59 +0200 Sun, 31 Aug 2014 23:59:59 +0200 Thu, 31 Jul 2014 23:59:59 +0200 Mon, 30 Jun 2014 23:59:59 +0200 Sat, 31 May 2014 23:59:59 +0200 Wed, 30 Apr 2014 23:59:59 +0200 Mon, 31 Mar 2014 23:59:59 +0200 Fri, 28 Feb 2014 23:59:59 +0100 Fri, 31 Jan 2014 23:59:59 +0100 Tue, 31 Dec 2013 23:59:59 +0100
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Wed, 31 Dec 2014 23:59:59 +0100 Thu, 01 Jan 1970 01:00:00 +0100 Thu, 01 Jan 1970 01:00:00 +0100 Thu, 01 Jan 1970 01:00:00 +0100 Thu, 01 Jan 1970 01:00:00 +0100 Thu, 01 Jan 1970 01:00:00 +0100 Thu, 01 Jan 1970 01:00:00 +0100 Thu, 01 Jan 1970 01:00:00 +0100 Thu, 01 Jan 1970 01:00:00 +0100 Thu, 01 Jan 1970 01:00:00 +0100 Thu, 01 Jan 1970 01:00:00 +0100 Thu, 01 Jan 1970 01:00:00 +0100 Thu, 01 Jan 1970 01:00:00 +0100
Output for 4.3.11, 4.4.0 - 4.4.9, 5.0.4 - 5.0.5
Wed, 31 Dec 2014 23:59:59 +0100 Thu, 01 Jan 1970 00:59:59 +0100 Thu, 01 Jan 1970 00:59:59 +0100 Thu, 01 Jan 1970 00:59:59 +0100 Thu, 01 Jan 1970 00:59:59 +0100 Thu, 01 Jan 1970 00:59:59 +0100 Thu, 01 Jan 1970 00:59:59 +0100 Thu, 01 Jan 1970 00:59:59 +0100 Thu, 01 Jan 1970 00:59:59 +0100 Thu, 01 Jan 1970 00:59:59 +0100 Thu, 01 Jan 1970 00:59:59 +0100 Thu, 01 Jan 1970 00:59:59 +0100 Thu, 01 Jan 1970 00:59:59 +0100
Output for 4.3.0 - 4.3.10, 5.0.0 - 5.0.3
Wed, 31 Dec 2014 23:59:59 +0100 Thu, 1 Jan 1970 00:59:59 +0100 Thu, 1 Jan 1970 00:59:59 +0100 Thu, 1 Jan 1970 00:59:59 +0100 Thu, 1 Jan 1970 00:59:59 +0100 Thu, 1 Jan 1970 00:59:59 +0100 Thu, 1 Jan 1970 00:59:59 +0100 Thu, 1 Jan 1970 00:59:59 +0100 Thu, 1 Jan 1970 00:59:59 +0100 Thu, 1 Jan 1970 00:59:59 +0100 Thu, 1 Jan 1970 00:59:59 +0100 Thu, 1 Jan 1970 00:59:59 +0100 Thu, 1 Jan 1970 00:59:59 +0100