$klein->respond('GET', '/getPaths/[:name]', function($request,$response) {

$path00 = "../manga/" . $request->name;

function getAll($path00)
{
    $dirs = [];
    foreach (new DirectoryIterator($path00) as $item) {
        if (!$item->isDir() || $item->isDot()) {
            continue;
        }
        $gedo = [];
        $path01  = $path00 . "/" . $item;
        $path02 = substr($path01, 3);
        $yol = new DirectoryIterator($path01);
        foreach ($yol as $esya) {
            if (!$esya->isDot() && $esya->getFilename() !== ".DS_Store") {
                $gedo[] = $path02 . "/" .  $esya->getFilename();

            }
        }
        
        $dirs[] = array('klasor' => $item->getFilename(), 'yol' => $gedo);

    }
    return $dirs;

};
$data = getAll($path00);
$response->json($data);



});
Arkadaşlar yukarıdaki fonksiyonda 'yol' => $gedo dizisini natural sort yapmak istiyorum fakat bu haliyle hata veriyor. Yardımcı olur musunuz? Fonksiyonun çıktısı kısaca şöyle;

klasor:642, yol:[1.jpg,2.jpg,3.jpg.....]
klasor:643, yol:[1.jpg,2.jpg,3.jpg.....]