What would be a good way to varify that a php variable contains either all letters or all numbers. Is it possible? I am kind of thinking of something similar to the NaN function in Javascript.
here's the example shown from the php manual. the link will give you about all te information you'll need to get your own built for the specific needs.
<?php
// The "i" after the pattern delimiter indicates a case-insensitive search
if (preg_match("/php/i", "PHP is the web scripting language of choice.") {
echo "A match was found.";
} else {
echo "A match was not found.";
}
?>
although this is a javascript tutorial, the nice thing about regular expressions patterns is they are pretty much universal as far as patterns go. so numeric match being \d in javascript, vbscript, python and php is nonchanging
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.