I have a list with these values:
<li data-breadcrumb="Caixa 1 - Quarto 2 - Casa 3"> Conteúdo </li>
And I would like to reverse their order in PHP.
I made a function
function inverte_breadcrumb($texto){
$texto = explode(' - ', $texto);
$texto = array_reverse($texto);
$texto = implode(' - ', $texto);
return $texto;
}
And with preg_replace I thought about doing the following:
$novaslinhas = preg_replace("/data-breadcrumb="(.*)"/", 'data-breadcrumb="' . inverte_breadcrumb("$1") . '"', $novaslinhas);
But, it does not call the function.
Does anyone know why?