3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php /** * Returns the day name according to the current locale * * @param int $n The day number (ISO-8601 numeric representation) * @param string $lc The desired locale for the returned day name * * @return string The day name */ function day_name(int $n, string $lc = "en_GB") { // Store the current locale so that we can reset it $olc = setlocale(LC_TIME, "0"); // Set the locale according to the $locale passed in setlocale(LC_TIME, $lc); // Get the day name according to the $locale passed in $output = strftime("%A", strtotime("Last Sunday +{$n} days")); // Reset the locale setLocale(LC_TIME, $olc); // Return the day name return $output; } echo day_name(4, "fr_FR");
Output for hhvm-3.18.5 - 3.22.0, 7.1.0 - 7.3.0rc3
Thursday
Output for 5.6.0 - 5.6.30
Fatal error: Default value for parameters with a class type hint can only be NULL in /in/pj1DH on line 11
Process exited with code 255.