Code:$myVariable1 = "("; $myVariable2 = "a3bc123"; $myVariable3 = "ze3>1fg"; $myVariable4 = "35%cd:";
In case of myVariable1, it has a special character only, i.e. (.
In case of myVariable2, it has no special characters.
In case of myVariable3, it has a special character, i.e. >.
In case of myVariable4, it has some special characters, i.e. % and :.
I like to make a condition about myVariables has any special characters, i.e. (,),$,>,>,:,;,,,%,/.
In case of myVariable1, myVariable3, and myVariable4, it says "yes".Code:if ( $myVariables has any special characters ) { echo "yes"; } else { echo "no;}
and In case of myVariable2, it says "no".
How can I check myVariables has special characters or not?



Reply With Quote

Bookmarks