Skip to content

Instantly share code, notes, and snippets.

@jpswade
Created January 19, 2013 10:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpswade/4571750 to your computer and use it in GitHub Desktop.
Save jpswade/4571750 to your computer and use it in GitHub Desktop.
How do you remove numbers from a string in PHP?
<?php
$string = 'abc123';
$string = str_replace(range(0,9), '', $string);
echo $string;
/* http://codepad.org/AYECJrbZ */
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment