// Définir l'ordre souhaité des fichiers $ordre = ['Qui', 'Materiels', 'Tarifs']; foreach ($ordre as $filename) { _ // Rechercher le fichier correspondant dans $files _ $foundFile = null; _ foreach ($files as $file) { __ $pathinfo = pathinfo($file); __ if ($pathinfo['extension'] === 'php' && $pathinfo['filename'] === 'vig'.$filename.'.blade') { ___ $foundFile = $file; ___ break; __} _} __if ($foundFile !== null) { ____$pathinfo = pathinfo($foundFile); ____$title = str_replace('_', ' ', $pathinfo['filename']); ____$title = str_replace('.blade', '', $title); ____$title = str_replace('vig', '', $title); ____$cards[$title] = [ ______'title' => $title, ______'include' => 'vig.vig' . $title, ______'url' => empty($title) ? "#" : strtolower($title), ____]; __} } foreach ($files as $file) { __$pathinfo = pathinfo($file); __if ($pathinfo['extension'] === 'php') { ____$title = str_replace('_', ' ', $pathinfo['filename']); ____$title = str_replace('.blade', '', $title); ____$title = str_replace('vig', '', $title); __ ____if (isset($cards[$title]) || in_array($title, $ordre)) { _____continue; ____} __ ____$cards[$title] = [ ______'title' => $title, ______'include' => 'vig.vig' . $title, ______'url' => strtolower($title), ____]; __} } // Réindexer les clés du tableau $cards = array_values($cards); ?>