Sorting an array of directory filenames in descending natural order

前端 未结 3 1452
没有蜡笔的小新
没有蜡笔的小新 2021-01-25 09:06

I have a content directory to be returned in descending natural order.

I\'m using scandir() and natsort(), but the addition of array_reve

3条回答
  •  迷失自我
    2021-01-25 09:50

     $dir='dead_dir/dead_content/';
     $launcher= scandir($dir);
     natsort($launcher);
     $r_launcher = array_reverse($launcher,true);
    
     foreach($r_launcher as $value ){
       if(in_array(pathinfo($value, PATHINFO_EXTENSION),array('png'))){
           echo ''}}
    

提交回复
热议问题