3v4l.org

run code in 300+ PHP versions simultaneously
<?php $activities= array("Date,Num_Days,Event,Location","3/3/2018,1,Rosary of the Unborn,In Front of Planned Parenthood","4/4/2018,2,Sell Raffle Tickets,St. Eugene Church"); $monthNames = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); $omonth = -1; $start = TRUE; print_r ($activities); print_r ($monthNames); print_r ($omonth); if ($start == True) {; print_r ("TRUE"); } $today = new DateTime("yesterday"); print_r ($today); $len_activities=sizeof($activities); for ($i = 1; $i < $len_activities; $i++) { $activity = $activities[$i]; print_r ($activity . "\n"); $activity = $activities[$i]; $activity_array = str_getcsv ($activity,",") ; print_r ($activity_array); $d = DateTime($activity_array[0]); print_r ($d); $month = date("n",$d); print_r ("\n".$month."\n"); }
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.33, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Array ( [0] => Date,Num_Days,Event,Location [1] => 3/3/2018,1,Rosary of the Unborn,In Front of Planned Parenthood [2] => 4/4/2018,2,Sell Raffle Tickets,St. Eugene Church ) Array ( [0] => January [1] => February [2] => March [3] => April [4] => May [5] => June [6] => July [7] => August [8] => September [9] => October [10] => November [11] => December ) -1TRUEDateTime Object ( [date] => 2018-03-26 00:00:00.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) 3/3/2018,1,Rosary of the Unborn,In Front of Planned Parenthood Array ( [0] => 3/3/2018 [1] => 1 [2] => Rosary of the Unborn [3] => In Front of Planned Parenthood ) Fatal error: Uncaught Error: Call to undefined function DateTime() in /in/G6RqD:21 Stack trace: #0 {main} thrown in /in/G6RqD on line 21
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Array ( [0] => Date,Num_Days,Event,Location [1] => 3/3/2018,1,Rosary of the Unborn,In Front of Planned Parenthood [2] => 4/4/2018,2,Sell Raffle Tickets,St. Eugene Church ) Array ( [0] => January [1] => February [2] => March [3] => April [4] => May [5] => June [6] => July [7] => August [8] => September [9] => October [10] => November [11] => December ) -1TRUEDateTime Object ( [date] => 2018-03-26 00:00:00.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) 3/3/2018,1,Rosary of the Unborn,In Front of Planned Parenthood Array ( [0] => 3/3/2018 [1] => 1 [2] => Rosary of the Unborn [3] => In Front of Planned Parenthood ) Fatal error: Uncaught Error: Call to undefined function DateTime() in /in/G6RqD:21 Stack trace: #0 {main} thrown in /in/G6RqD on line 21
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 8.0.13
Array ( [0] => Date,Num_Days,Event,Location [1] => 3/3/2018,1,Rosary of the Unborn,In Front of Planned Parenthood [2] => 4/4/2018,2,Sell Raffle Tickets,St. Eugene Church ) Array ( [0] => January [1] => February [2] => March [3] => April [4] => May [5] => June [6] => July [7] => August [8] => September [9] => October [10] => November [11] => December ) -1TRUEDateTime Object ( [date] => 2018-03-26 00:00:00.000000 [timezone_type] => 3 [timezone] => UTC ) 3/3/2018,1,Rosary of the Unborn,In Front of Planned Parenthood Array ( [0] => 3/3/2018 [1] => 1 [2] => Rosary of the Unborn [3] => In Front of Planned Parenthood ) Fatal error: Uncaught Error: Call to undefined function DateTime() in /in/G6RqD:21 Stack trace: #0 {main} thrown in /in/G6RqD on line 21
Process exited with code 255.

preferences:
166.25 ms | 402 KiB | 159 Q