<?php
function inverteData($data){
}
}
$data = "12/11/2018";
//para usar na query
$dataInvertida = inverteData($data);
echo $dataInvertida;
echo PHP_EOL;
//alguma data retornada do select
$dataBanco = "2018-11-21";
$dataBancoInvertida = inverteData($dataBanco);
//imprime na tela
echo $dataBancoInvertida;
PD9waHAKCmZ1bmN0aW9uIGludmVydGVEYXRhKCRkYXRhKXsKICAgIGlmKGNvdW50KGV4cGxvZGUoIi8iLCRkYXRhKSkgPiAxKXsKICAgICAgICByZXR1cm4gam9pbigiLSIsYXJyYXlfcmV2ZXJzZShleHBsb2RlKCIvIiwkZGF0YSkpKTsKICAgIH1lbHNlaWYoY291bnQoZXhwbG9kZSgiLSIsJGRhdGEpKSA+IDEpewogICAgICAgIHJldHVybiBqb2luKCIvIixhcnJheV9yZXZlcnNlKGV4cGxvZGUoIi0iLCRkYXRhKSkpOwogICAgfQp9CiAKJGRhdGEgPSAiMTIvMTEvMjAxOCI7CiAKLy9wYXJhIHVzYXIgbmEgcXVlcnkKJGRhdGFJbnZlcnRpZGEgPSBpbnZlcnRlRGF0YSgkZGF0YSk7CiAKZWNobyAkZGF0YUludmVydGlkYTsKIAplY2hvIFBIUF9FT0w7CiAKLy9hbGd1bWEgZGF0YSByZXRvcm5hZGEgZG8gc2VsZWN0CiRkYXRhQmFuY28gPSAiMjAxOC0xMS0yMSI7CiAKJGRhdGFCYW5jb0ludmVydGlkYSA9ICBpbnZlcnRlRGF0YSgkZGF0YUJhbmNvKTsKIAovL2ltcHJpbWUgbmEgdGVsYQogCmVjaG8gJGRhdGFCYW5jb0ludmVydGlkYTs=