# deprecated strftime in PHP 8.1

I saw that strftime is deprecated in PHP 8.1. I saw I can use a class include in intl but I'm not sure to understand how to use It.

On my site I use this function with the array $datesToConvert{020222, 030222, ...} which means "02 Février 2022" function compareDate($date1, $date2){ return strtotime($date2) - strtotime($date1); } usort($datesToConvert, "compareDate");

//Generate Array titles and Array
foreach($datesToConvert as$element){
$titles[] = "Vidéo du " . strftime('%d', strtotime($element)) . " " . ucfirst(strftime('%B', strtotime(\$element)));
}


The Output is like "Vidéo du 02 Février"

May I have to rewrite my code in another way ?

Regards.

ps : sorry for my poor english i'm french.

• as for me this question is good on Stackoverflow.com, not on Code Review. Using Google I even found on Stackoverflow: PHP 8.1: strftime() is deprecated - Stack Overflow and also some post (which you can find also in comments on question on stackoverflow) strftime and gmstrftime functions are deprecated - PHP 8.1 • PHP.Watch Mar 3, 2022 at 14:18
• Thank you for the link I will study this solution. Mar 3, 2022 at 14:32
• So is this question off-topic because it does not work as coded? Mar 4, 2022 at 0:27
• If you are going from PHP8.1 and up, this looks simple: 3v4l.org/XGsCA but I'm not sure if I should post an answer. I'll wait to hear from more experienced content curators. Mar 4, 2022 at 0:40
• @mickmackusa after reviewing this it seems on-topic; yes deprecated warnings, if not suppressed, could cause things to break (e.g. code using it from via XHR requests) but that doesn't mean this code is broken Apr 14, 2022 at 17:15