1, 'title' => 'Introduction à la culture libre et aux logiciels open source', 'thumbnail' => 'img/video-thumbnails/featured-1.jpg', 'duration' => 1245, // en secondes 'channel' => 'Tech Libre', 'views' => 15420, 'date' => '2023-11-15' ], [ 'id' => 2, 'title' => 'La Réunion: Découverte des sentiers cachés', 'thumbnail' => 'img/video-thumbnails/featured-2.jpg', 'duration' => 843, 'channel' => 'Île Aventure', 'views' => 8745, 'date' => '2023-12-02' ], [ 'id' => 3, 'title' => 'Comment installer Linux sur un ancien ordinateur', 'thumbnail' => 'img/video-thumbnails/featured-3.jpg', 'duration' => 723, 'channel' => 'Tech Libre', 'views' => 24680, 'date' => '2023-10-25' ] ]; // Affichage des vidéos foreach ($featuredVideos as $video) : ?>
<?php echo $video['title']; ?>

0) { return sprintf('%d:%02d:%02d', $hours, $minutes, $remainingSeconds); } else { return sprintf('%d:%02d', $minutes, $remainingSeconds); } } function formatViewCount($views) { if ($views >= 1000000) { return round($views / 1000000, 1) . 'M'; } elseif ($views >= 1000) { return round($views / 1000, 1) . 'K'; } else { return $views; } } function formatDate($dateString) { $date = new DateTime($dateString); $now = new DateTime(); $interval = $now->diff($date); if ($interval->days == 0) { return 'Aujourd\'hui'; } elseif ($interval->days == 1) { return 'Hier'; } elseif ($interval->days < 7) { return 'Il y a ' . $interval->days . ' jours'; } elseif ($interval->days < 30) { $weeks = floor($interval->days / 7); return 'Il y a ' . $weeks . ' semaine' . ($weeks > 1 ? 's' : ''); } elseif ($interval->days < 365) { $months = floor($interval->days / 30); return 'Il y a ' . $months . ' mois'; } else { $years = floor($interval->days / 365); return 'Il y a ' . $years . ' an' . ($years > 1 ? 's' : ''); } } ?>