Created
December 17, 2024 08:55
-
-
Save shohag-cse-knu/1c759200ff8f2e3da1a08ad5996cd2b9 to your computer and use it in GitHub Desktop.
Replacing all characters with empty character and keeping only alphanumeric characters
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
<?php | |
$var = "SRSabc__098"; | |
echo preg_replace('/[^A-Za-z0-9]/', '', trim($var)); | |
/* | |
Result: | |
SRSabc098 | |
*/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment