Skip to content

Instantly share code, notes, and snippets.

@kruxor
Created August 17, 2015 04:27
Show Gist options
  • Save kruxor/ad8e394ebf037e64b9e1 to your computer and use it in GitHub Desktop.
Save kruxor/ad8e394ebf037e64b9e1 to your computer and use it in GitHub Desktop.
Only include numbers in a string
<?php
$str = "123fghy567";
$str = preg_replace('/\D/', '', $str);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment