Skip to content

Instantly share code, notes, and snippets.

@camt
Created January 31, 2012 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save camt/1707761 to your computer and use it in GitHub Desktop.
Save camt/1707761 to your computer and use it in GitHub Desktop.
Strip 'X' end characters from a string with PHP. This is faster for longer strings, as it does not need to count it's way to the end of the string first.
$string = strrev(substr(strrev($string), 2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment