Sto creando una funzione per tradurre
Come se mi aggiungesse alla fine il numero di caratteri, come mai?Codice PHP:
function translate ($a, $b, $c) {
if ($c != 1) {
$trad = printf($a, $c);
}else{
$trad = printf($b, $c);
}
}
//dovrebbe scrivermi "Ci sono 5 stringhe" invece mi scrive "ci sono 5 stringhe18"
echo translate("ci sono %s stringhe", "ce %s stringa", 5);
//dovrebbe scrivermi "Ce 1 stringa" invece mi scrive "ce 1 stringa12"
echo translate("ci sono %s stringhe", "ce %s stringa", 1);