3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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); $nd = new DateTime($activity_array[0]); print_r ($nd); $month = $nd->format("n")-1; print_r ("\n".$month."\n"); if ($today <= $nd) { print_r ("Future Date".$nd."\n"); } }
based on hPhUB
Output for 7.1.0 - 7.3.0beta1
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 ) DateTime Object ( [date] => 2018-03-03 00:00:00.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) 2 4/4/2018,2,Sell Raffle Tickets,St. Eugene Church Array ( [0] => 4/4/2018 [1] => 2 [2] => Sell Raffle Tickets [3] => St. Eugene Church ) DateTime Object ( [date] => 2018-04-04 00:00:00.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) 3 Recoverable fatal error: Object of class DateTime could not be converted to string in /in/iGVHH on line 26
Process exited with code 255.
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.0.27
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 ) DateTime Object ( [date] => 2018-03-03 00:00:00.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) 2 4/4/2018,2,Sell Raffle Tickets,St. Eugene Church Array ( [0] => 4/4/2018 [1] => 2 [2] => Sell Raffle Tickets [3] => St. Eugene Church ) DateTime Object ( [date] => 2018-04-04 00:00:00.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) 3 Catchable fatal error: Object of class DateTime could not be converted to string in /in/iGVHH on line 26
Process exited with code 255.
Output for hhvm-3.22.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 ) DateTime Object ( [date] => 2018-03-03 00:00:00.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) 2 4/4/2018,2,Sell Raffle Tickets,St. Eugene Church Array ( [0] => 4/4/2018 [1] => 2 [2] => Sell Raffle Tickets [3] => St. Eugene Church ) DateTime Object ( [date] => 2018-04-04 00:00:00.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) 3 Fatal error: Uncaught Error: Object of class DateTime could not be converted to string in /in/iGVHH:-1 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.18.5 - 3.21.3
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 ) DateTime Object ( [date] => 2018-03-03 00:00:00.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) 2 4/4/2018,2,Sell Raffle Tickets,St. Eugene Church Array ( [0] => 4/4/2018 [1] => 2 [2] => Sell Raffle Tickets [3] => St. Eugene Church ) DateTime Object ( [date] => 2018-04-04 00:00:00.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) 3 Fatal error: Uncaught Error: Object of class DateTime could not be converted to string in /in/iGVHH:26 Stack trace: #0 {main}
Process exited with code 255.