How can I get a string that only contains a to z, A to Z, 0 to 9 and some symbols?
My string is: ��S�o�n�u� �N�i�g�a�m�,� �S�a�i�n�d�h�a�v�i
I would like to eliminate the symbols.
You can test your string (let $str
) using preg_match
:
if(preg_match("/^[a-zA-Z0-9]+$/", $str) == 1) {
// string only contain the a to z , A to Z, 0 to 9
}
If you need more symbols you can add them before ]