Si può spezzare in due una stringa che supera tot caratteri ? Ve lo chiedo perchè con un titolo tutto attaccato tipo "s68f6af57g9s5g787fs9hf9" mi sfalsa il layout del sito
Si può spezzare in due una stringa che supera tot caratteri ? Ve lo chiedo perchè con un titolo tutto attaccato tipo "s68f6af57g9s5g787fs9hf9" mi sfalsa il layout del sito
Certo, utilizzando:
OppureCodice PHP:
$myText = 'asdfgtthdffjkjksknjhhasdghhjaskdhga';
$myText = wordwrap($myText, 20, '
', 1);
Il primo manda a capo dopo 20 caratteri.Codice PHP:
$myText = 'asdfgtthdffjkjksknjhhasdghhjaskdhga';
$myText = substr($myText, 0, 20) . '...';
Il secondo spezza e aggiunge ... alla fine della frase dopo 20 caratteri.
Se Hai dubbi chiedi pure![]()
Favorites:
Short links, are better!