The problem is that this way is only returning the last column of the database
public function Acentos ( $string ) {
$Acentos = $this->SelectDados(
"*",
"table",
"",
array ()
);
foreach ( $Acentos as $List ) {
$table = array (
$List['slug'] => utf8_encode ( $List['nome'] )
);
}
return strtr ( $string, $table );
}
I tried to do like this
$Dados = array ();
foreach ( $Acentos as $List ) {
$table = array (
$Dados[] = $List['slug'] => utf8_encode ( $Dados[] = $List['nome'] )
);
}
With array_push gives the following error
public function Acentos ( $string ) {
$Table = array();
$Acentos = $this->SelectDados(
"*",
"table",
"",
array ()
);
foreach ( $Acentos as $List ) {
array_push ( $Table,
$List['slug'] => utf8_encode ( $List['nome'] )
);
}
return strtr ( $string, $Table );
}
Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ')'
As I understand it array_push does not accept special characters =>
how to fix this?