Specifications
while (list($key, $value) = each ($arr))
echo “<br>”.$value;
This splits the host name into its five components and prints each on a separate line.
Comparison of String Functions and Regular
Expression Functions
In general, the regular expression functions run less efficiently than the string functions with
similar functionality. If your application is simple enough to use string expressions, do so.
Further Reading
The amount of material available on regular expressions is enormous. You can start with the
man page for regexp if you are using UNIX and there are also some terrific articles at
devshed.com and phpbuilder.com.
At Zend’s Web site, you can look at a more complex and powerful email validation function
than the one we developed here. It is called MailVal() and is available at
http://www.zend.com/codex.php?id=88&single=1.
Regular expressions take awhile to sink in—the more examples you look at and run, the more
confident you will be using them.
Next
In the next chapter, we’ll discuss several ways you can use PHP to save programming time and
effort and prevent redundancy by reusing pre-existing code.
Using PHP
P
ART I
116
06 7842 CH04 3/6/01 3:41 PM Page 116