Sorry about that, no harm intended, was just feeling to lazy to rewrite it myself lol.
Here are the test results that I ran locally, which as an above poster mentioned probably aren't 100% accurate in a live environment, but is good for comparing overhead. Also, note that on longer strings, regular expressions seem to be more efficient than string functions (after ~5000 characters).
[php]
<?php
$STR = "test";
print (strspn($STR,"abcdefghijklmnopqrstuvwxyz") == strlen($STR)) ? "success" : "fail";
//this script took 0.029 ms to execute
?>
<?php
$str = "test";
print (preg_match('/^[a-z]*$/', $str)) ? "success" : "fail";
//this script took 0.368 ms to execute
//thats more than a 10x decrease in performance
?> [/php]
Also, that syntax is known as regular expressions, it's for matching patterns in strings. It's daunting at first, but the
tutorial I found does a really good job of explaining it. It takes about an hour or so to read through, and tends to be slightly repetitive, but really hammers the point across to
exactly how regular expressions work.