<?php
// As datas
$dataInicial = "2018-07-20";
$dataFinal = "2018-07-24";
// Quebra as strings nos "-" e transforma cada pedaço numa matriz
$divisorIni = explode("-", $dataInicial); $divisorFin = explode("-", $dataFinal);
// Inverte os pedaços
// Junta novamente a matriz em texto separado por tracinho (-)
$dataIni = implode("-", $reversoIni); $dataFin = implode("-", $reversoFin);
echo $dataIni;
echo "\n";
echo $dataFin;
PD9waHAKCi8vIEFzIGRhdGFzCiRkYXRhSW5pY2lhbCA9ICIyMDE4LTA3LTIwIjsKJGRhdGFGaW5hbCA9ICIyMDE4LTA3LTI0IjsKCi8vIFF1ZWJyYSBhcyBzdHJpbmdzIG5vcyAiLSIgZSB0cmFuc2Zvcm1hIGNhZGEgcGVkYcOnbyBudW1hIG1hdHJpegokZGl2aXNvckluaSA9IGV4cGxvZGUoIi0iLCAkZGF0YUluaWNpYWwpOwokZGl2aXNvckZpbiA9IGV4cGxvZGUoIi0iLCAkZGF0YUZpbmFsKTsKCi8vIEludmVydGUgb3MgcGVkYcOnb3MKJHJldmVyc29JbmkgPSBhcnJheV9yZXZlcnNlKCRkaXZpc29ySW5pKTsKJHJldmVyc29GaW4gPSBhcnJheV9yZXZlcnNlKCRkaXZpc29yRmluKTsKCi8vIEp1bnRhIG5vdmFtZW50ZSBhIG1hdHJpeiBlbSB0ZXh0byBzZXBhcmFkbyBwb3IgdHJhY2luaG8gKC0pCiRkYXRhSW5pID0gaW1wbG9kZSgiLSIsICRyZXZlcnNvSW5pKTsKJGRhdGFGaW4gPSBpbXBsb2RlKCItIiwgJHJldmVyc29GaW4pOwoKCmVjaG8gJGRhdGFJbmk7ICAKZWNobyAiXG4iOwplY2hvICRkYXRhRmluOw==