For instance, it??™s conceivable you??™ll be tasked with inputting and
validating a telephone number or a state abbreviation, regardless of whether you??™re
dealing with a client, a patient, a staff member, or a customer. Such repeatability
certainly presents the opportunity to create a library that is capable of handling such
matters, regardless of the application. Indeed, because we??™re faced with such repeatable
tasks, it follows that other programmers are, too. Therefore, it??™s always prudent
to investigate whether somebody has already done the hard work for you and made a
package available via PEAR.
?– Note If you??™re unfamiliar with PEAR, take some time to review Chapter 11 before continuing.
Sure enough, a quick PEAR search turns up Validate_US, a package that is capable
of validating various informational items specific to the United States. Although still in
beta at press time, Validate_US was already capable of syntactically validating phone
numbers, SSNs, state abbreviations, and ZIP codes. This section shows you how to
install and implement this immensely useful package.
Installing Validate_US
To take advantage of Validate_US, you need to install it. The process for doing so follows:
%>pear install -f Validate_US
WARNING: failed to download pear.php.net/Validate_US within preferred
state "stable", will instead download version 0.5.2, stability "beta"
downloading Validate_US-0.
Pages:
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349