<?php

$files=[
	"01012016.txt", "01012017.txt",
	"01012018.txt", "01012019.txt",
	"01012020.txt", "01012016.txt",
	"02012016.txt", "03012016.txt",
	"13092020.txt"
];


print_r($files);

$files = array_map(function($file){
	$obj = new stdClass;
	$obj->file = $file;
	
	$file_name = pathinfo($file)['filename'];
	$obj->date = DateTime::createFromFormat(
		'dmY', $file_name)->format('Ymd');
	return $obj;
}, $files);

uasort($files, function($a, $b) {
	return strcmp($a->date, $b->date);
});


print_r($files);
