3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date = new DateTime(''); $date->modify('first day of month'); $i = new DateInterval('P1M'); $end = new DateTime('-1 year'); while ($date >= $end) { echo $date->format('Y F') . PHP_EOL; $date = $date->sub($i); }
Output for 8.3.0 - 8.3.6
Fatal error: Uncaught DateMalformedStringException: DateTime::modify(): Failed to parse time string (first day of month) at position 13 (m): The timezone could not be found in the database in /in/Y3KRk:3 Stack trace: #0 /in/Y3KRk(3): DateTime->modify('first day of mo...') #1 {main} thrown in /in/Y3KRk on line 3
Process exited with code 255.
Output for 5.3.2 - 5.3.28, 5.4.0 - 5.4.27, 5.6.28, 7.0.14 - 7.0.20, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Warning: DateTime::modify(): Failed to parse time string (first day of month) at position 13 (m): The timezone could not be found in the database in /in/Y3KRk on line 3 2014 April 2014 March 2014 March 2014 February 2014 January 2013 December 2013 November 2013 October 2013 September 2013 August 2013 July 2013 June 2013 May
Output for 5.5.24, 5.5.35, 5.6.21, 7.0.6
Warning: DateTime::modify(): Failed to parse time string (first day of month) at position 13 (m): The timezone could not be found in the database in /in/Y3KRk on line 3 2016 May 2016 April 2016 March 2016 February 2016 January 2015 December 2015 November 2015 October 2015 September 2015 August 2015 July 2015 June 2015 May
Output for 5.5.25 - 5.5.30, 5.5.34, 5.6.9 - 5.6.14, 5.6.20, 7.0.5
Warning: DateTime::modify(): Failed to parse time string (first day of month) at position 13 (m): The timezone could not be found in the database in /in/Y3KRk on line 3 2016 April 2016 March 2016 February 2016 January 2015 December 2015 November 2015 October 2015 September 2015 August 2015 July 2015 June 2015 May 2015 April
Output for 5.5.31 - 5.5.33, 5.6.15 - 5.6.19, 7.0.0 - 7.0.4
Warning: DateTime::modify(): Failed to parse time string (first day of month) at position 13 (m): The timezone could not be found in the database in /in/Y3KRk on line 3 2016 March 2016 February 2016 January 2015 December 2015 November 2015 October 2015 September 2015 August 2015 July 2015 June 2015 May 2015 April 2015 March
Output for 5.6.8
Warning: DateTime::modify(): Failed to parse time string (first day of month) at position 13 (m): The timezone could not be found in the database in /in/Y3KRk on line 3 2016 April 2016 March 2016 March 2016 February 2016 January 2015 December 2015 November 2015 October 2015 September 2015 August 2015 July 2015 June 2015 May
Output for 5.4.45
Warning: DateTime::modify(): Failed to parse time string (first day of month) at position 13 (m): The timezone could not be found in the database in /in/Y3KRk on line 3 2015 September 2015 August 2015 July 2015 June 2015 May 2015 April 2015 March 2015 February 2015 January 2014 December 2014 November 2014 October 2014 September
Output for 5.4.39 - 5.4.44
Warning: DateTime::modify(): Failed to parse time string (first day of month) at position 13 (m): The timezone could not be found in the database in /in/Y3KRk on line 3 2015 August 2015 July 2015 June 2015 May 2015 April 2015 March 2015 February 2015 January 2014 December 2014 November 2014 October 2014 September 2014 August
Output for 5.4.34 - 5.4.38
Warning: DateTime::modify(): Failed to parse time string (first day of month) at position 13 (m): The timezone could not be found in the database in /in/Y3KRk on line 3 2015 March 2015 February 2015 January 2014 December 2014 November 2014 October 2014 September 2014 August 2014 July 2014 June 2014 May 2014 April 2014 March
Output for 5.3.29, 5.4.28 - 5.4.32
Warning: DateTime::modify(): Failed to parse time string (first day of month) at position 13 (m): The timezone could not be found in the database in /in/Y3KRk on line 3 2014 September 2014 August 2014 July 2014 June 2014 May 2014 April 2014 March 2014 February 2014 January 2013 December 2013 November 2013 October 2013 September
Output for 5.3.0 - 5.3.1
2014 April 2014 March 2014 February 2014 January 2013 December 2013 November 2013 October 2013 September 2013 August 2013 July 2013 June 2013 May
Output for 5.2.13 - 5.2.17
Warning: DateTime::modify(): Failed to parse time string (first day of month) at position 10 (o): The timezone could not be found in the database in /in/Y3KRk on line 3 Fatal error: Class 'DateInterval' not found in /in/Y3KRk on line 4
Process exited with code 255.
Output for 5.2.0 - 5.2.12
Fatal error: Class 'DateInterval' not found in /in/Y3KRk on line 4
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/Y3KRk on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/Y3KRk on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/Y3KRk on line 2

preferences:
196.91 ms | 401 KiB | 312 Q