<?php
//função para ordenar
function comparaPorTimeStamp($time1, $time2)
{
return 1;
return -1;
else
return 0;
}
$var = array("12/08", "13/08", "06/08");
foreach( $var as $value ) {
//inverte dia com mes e substitui por traço
//transforma em data valida
$arquivo= "2018-".$value;
//cria o array
$lista[] .= $arquivo;
}
//ordena por data crescente
usort($lista, "comparaPorTimeStamp");
//vamos ao que interessa
foreach( $lista as $valor ) {
//$value=str_replace("-","/",$value);
$datas[] .= $valor;
}
PD9waHAKCi8vZnVuw6fDo28gcGFyYSBvcmRlbmFyCmZ1bmN0aW9uIGNvbXBhcmFQb3JUaW1lU3RhbXAoJHRpbWUxLCAkdGltZTIpCnsKICAgIGlmIChzdHJ0b3RpbWUoJHRpbWUxKSA+IHN0cnRvdGltZSgkdGltZTIpKQogICAgICAgIHJldHVybiAxOwogICAgZWxzZSBpZiAoc3RydG90aW1lKCR0aW1lMSkgPiBzdHJ0b3RpbWUoJHRpbWUyKSkgCiAgICAgICAgcmV0dXJuIC0xOwogICAgZWxzZQogICAgICAgIHJldHVybiAwOwp9CgoKJHZhciA9IGFycmF5KCIxMi8wOCIsICIxMy8wOCIsICIwNi8wOCIpOwogCmFycmF5X3B1c2goJHZhciwgIjEwLzA4Iik7CmFycmF5X3B1c2goJHZhciwgIjE1LzA4Iik7CmFycmF5X3B1c2goJHZhciwiMTEvMDgiKTsgICAgICAgCiAKIAokdmFyID0gYXJyYXlfdW5pcXVlKCR2YXIpOwkKCiRsaXN0YSA9IGFycmF5KCk7Cgpmb3JlYWNoKCAkdmFyIGFzICR2YWx1ZSApIHsKCS8vaW52ZXJ0ZSBkaWEgY29tIG1lcyBlIHN1YnN0aXR1aSBwb3IgdHJhw6dvCgkkdmFsdWU9IGpvaW4oIi0iLGFycmF5X3JldmVyc2UoZXhwbG9kZSgiLyIsJHZhbHVlKSkpOwoJCgkvL3RyYW5zZm9ybWEgZW0gZGF0YSB2YWxpZGEKCSRhcnF1aXZvPSAiMjAxOC0iLiR2YWx1ZTsKCS8vY3Jp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