3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ISOdates_from_weeknr ($weeknr, $year, $format = '%d-%m-%Y') { $start = strtotime ('1 january ' . $year); $week1 = strftime ('%V', $start); while ($week1 != '01') { $start += (7 * 24 * 3600); $week1 = strftime ('%V', $start); } $timestamp_week = strtotime ('+' . ($weeknr - 1) . ' week', $start); $weekdag = strftime ('%u', $timestamp_week); $dagen_tot_begin_week = $weekdag - 1; $dagen_tot_eind_week = 7 - $weekdag; $checkdatum = strtotime ("-" . $dagen_tot_begin_week . " days + 3 days", $timestamp_week); $check = strftime ('%V', $checkdatum); if ($check == '01' && $weeknr > 52) { echo 'ongeldig weeknummer voor dit jaar' . "\n"; return false; } $begindatum = strtotime ("-" . $dagen_tot_begin_week . " days", $timestamp_week); $einddatum = strtotime ("+" . $dagen_tot_eind_week . " days", $timestamp_week); return array (strftime ($format, $begindatum), strftime ($format, $einddatum)); } //echo "Output for 5.4.11 - 7.0.2, 7.1@2015-11, hhvm-3.6.1 - 3.11.0".PHP_EOL; //echo ISOdates_from_weeknr(1, 2016)[0].PHP_EOL; //echo ISOdates_from_weeknr(1, 2016)[1]; echo "Andere PHP die oud is".PHP_EOL; $date = ISOdates_from_weeknr(1, 2016); echo $date[0].PHP_EOL; echo $date[1].PHP_EOL; ?>
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Andere PHP die oud is Deprecated: Function strftime() is deprecated in /in/MThdS on line 4 Deprecated: Function strftime() is deprecated in /in/MThdS on line 7 Deprecated: Function strftime() is deprecated in /in/MThdS on line 10 Deprecated: Function strftime() is deprecated in /in/MThdS on line 14 Deprecated: Function strftime() is deprecated in /in/MThdS on line 21 Deprecated: Function strftime() is deprecated in /in/MThdS on line 21 04-01-2016 10-01-2016
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 Andere PHP die oud is Deprecated: Function strftime() is deprecated in /in/MThdS on line 4 Deprecated: Function strftime() is deprecated in /in/MThdS on line 7 Deprecated: Function strftime() is deprecated in /in/MThdS on line 10 Deprecated: Function strftime() is deprecated in /in/MThdS on line 14 Deprecated: Function strftime() is deprecated in /in/MThdS on line 21 Deprecated: Function strftime() is deprecated in /in/MThdS on line 21 04-01-2016 10-01-2016
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 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
Andere PHP die oud is 04-01-2016 10-01-2016

preferences:
252.06 ms | 403 KiB | 330 Q