Re: Re: Validation class comments
| From: | Manuel Lemos | Date: | Thu, 30 May 2002 01:10:59 +0000 |
| Subject: | Re: Re: Validation class comments | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-6631@lists.php.net to get a copy of this message | ||
Hello,
On 05/29/2002 03:14 PM, Peter Bowyer wrote:
Sure, I often use my e-mail validation class which is a complex class separate from the forms class.Because the built-in validation types just contain 2 lines and it does not pay to move them to separate classes.I was thinking of bigger validation routines going into separate classes, such as the Luhn algorithm for credit card validation.
Use the source, Luke. :-)You should learn how Zend compiler and PHP code loading and execution works before making such guesses.Very, true, only I don't know how to learn about these things :-)
It's a trade-off. You trade loading/compiling overhead for memory. This means that the compiled cached code will be using memory even if the current script does not need them. In the end detaching validation code from a main class will not make you gain anything because the code will be occupying memory whether you use it or not. -- Regards, Manuel LemosZend compiler separates compilations in 3 parts: global code, global functions and classes. If you move code from a class to create another with separated validation code, eventually you force a separate compilation process for that class with all the execution and memory overhead that incurs.Wouldn't using PHP-Accelerator get around this problem?