Re: Form Validation Issues
| From: | Robert Cummings | Date: | Wed, 23 May 2007 16:01:10 +0000 |
| Subject: | Re: Form Validation Issues | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-255420@lists.php.net to get a copy of this message | ||
On Wed, 2007-05-23 at 10:55 -0500, Greg Donald wrote:
> On 5/23/07, Robert Cummings <robert@interjinn.com> wrote:
> > > You should really look into learning in_array() for stuff like this.
> >
> > Wouldn't that slow things down and increase the memory footprint? ;)
>
> It'd be interesting to see a benchmark.
You're good at those... but I'll pull off the top of my head that the
array overhead ought to require more memory due to the need for indexes
(maybe) but at least for internal tree structure. The speed ought to
slow down since the array will need to be created and built. Then using
in_array() I'm guessing is a linear search since values aren't sorted
(at least I can't image the values being sorted). You could probably
overcome the speed issue using an array with the values as indexes
instead of the values and using isset() to check for membership of the
value :)
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'