Hi everyone!

I have a bunch of strings that end with a character that I don't want
(ie~
$string1="periods are bad."
$string2="I don't like colons:"
$string3="Down w/ all equal Signs!=";

What's the best way to just drop that last character from a string?

Thanks!
Jason

    Jason,

    There's all sorts of great functions for string manipulation in the String Functions section of the PHP ManualπŸ™‚ This will drop the last character from a given string:

       $newString = substr($oldString, 0, (strlen($oldString) - 1));

    HTH.

    Geoff A. Virgo

      Cool, thanks so much!

      I really appreciate it. I love this board! πŸ™‚

      Thanks again!
      Jason

        Write a Reply...