…
…
…
…
Nel tutorial di oggi vi mostreremo come rimuovere l’ultimo carattere da una stringa con PHP.
Vi mostreremo tre metodi per farlo e in tutti e utilizzeremo solamente funzioni messe a disposizione da PHP.
< ?php // method 1 - substr and mb_substr substr($string, 0, -1); mb_substr($string, 0, -1); // method 2 - substr_replace substr_replace($string, '', -1); // method 3 - rtrim // it trims all specified characters from end of the string rtrim($string, "."); ?> …