3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = strtotime("01-jan-2018"); $next = strtotime("next day", $start); $festivi = array( "Capodanno" => getMyDate("01-jan-2018"), "Epifania" => getMyDate("06-jan-2018"), "Pasqua" => getMyDate("01-apr-2018"), "Pasquetta" => getMyDate("02-apr-2018"), "Liberazione" => getMyDate("25-apr-2018"), "Lavoratori" => getMyDate("01-mag-2018"), "Repubblica" => getMyDate("02-jun-2018"), "Patrono" => getMyDate("29-jun-2018"), "Ferragosto" => getMyDate("15-aug-2018"), "TuttiSanti" => getMyDate("01-nov-2018"), "Immacolata" => getMyDate("08-dic-2018"), "Natale" => getMyDate("25-dic-2018"), "SantoStefano" => getMyDate("26-dic-2018") ); while($start != strtotime("01 jan 2019")){ if(isFestivo($festivi, $start)) echo date('d/m/Y', $start)."\t".$festivo[getFestivoIndex($festivi, $start)]["descrizione"]."\n"; else if(date('w',$start)==6) echo date('d/m/Y', $start)."\tS\n"; else if(date('w',$start)==7) echo date('d/m/Y', $start)."\tD\n"; else $start = strtotime("next day", $start); $start = strtotime("next day", $start); } function getMyDate($myDate){ return date('d/m/Y', strtotime($myDate)); } function isFestivo($festivi, $myDate){ foreach($festivi as $tempDescription => $tempDate) if($myDate == $tempDate) return true; return false; } function getFestivoIndex($festivi,$myDate){ $count = 0; foreach($festivi as $tempDescription => $tempDate) if($myDate == $tempDate) return $count; else $count++; return -1; }
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 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, 8.3.0 - 8.3.4, 8.3.6
13/01/2018 S 20/01/2018 S 27/01/2018 S 03/02/2018 S 10/02/2018 S 17/02/2018 S 24/02/2018 S 03/03/2018 S 10/03/2018 S 17/03/2018 S 24/03/2018 S 31/03/2018 S 07/04/2018 S 14/04/2018 S 21/04/2018 S 28/04/2018 S 05/05/2018 S 12/05/2018 S 19/05/2018 S 26/05/2018 S 02/06/2018 S 09/06/2018 S 16/06/2018 S 23/06/2018 S 30/06/2018 S 07/07/2018 S 14/07/2018 S 21/07/2018 S 28/07/2018 S 04/08/2018 S 11/08/2018 S 18/08/2018 S 25/08/2018 S 01/09/2018 S 08/09/2018 S 15/09/2018 S 22/09/2018 S 29/09/2018 S 06/10/2018 S 13/10/2018 S 20/10/2018 S 27/10/2018 S 03/11/2018 S 10/11/2018 S 17/11/2018 S 24/11/2018 S 01/12/2018 S 08/12/2018 S 15/12/2018 S 22/12/2018 S 29/12/2018 S
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 13/01/2018 S 20/01/2018 S 27/01/2018 S 03/02/2018 S 10/02/2018 S 17/02/2018 S 24/02/2018 S 03/03/2018 S 10/03/2018 S 17/03/2018 S 24/03/2018 S 31/03/2018 S 07/04/2018 S 14/04/2018 S 21/04/2018 S 28/04/2018 S 05/05/2018 S 12/05/2018 S 19/05/2018 S 26/05/2018 S 02/06/2018 S 09/06/2018 S 16/06/2018 S 23/06/2018 S 30/06/2018 S 07/07/2018 S 14/07/2018 S 21/07/2018 S 28/07/2018 S 04/08/2018 S 11/08/2018 S 18/08/2018 S 25/08/2018 S 01/09/2018 S 08/09/2018 S 15/09/2018 S 22/09/2018 S 29/09/2018 S 06/10/2018 S 13/10/2018 S 20/10/2018 S 27/10/2018 S 03/11/2018 S 10/11/2018 S 17/11/2018 S 24/11/2018 S 01/12/2018 S 08/12/2018 S 15/12/2018 S 22/12/2018 S 29/12/2018 S

preferences:
166.17 ms | 403 KiB | 193 Q