Last active
April 3, 2023 17:06
-
-
Save ocmca/f079d0d3abf73bba9653 to your computer and use it in GitHub Desktop.
returns a hyphenated creditcard number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// returns a hyphenated creditcard number | |
function creditCardFilter($str){ | |
$new = str_replace('/\D+/g','',$str); | |
return chunk_split($new,4,'-'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment