Re: Form Validation Issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2007-05-23 at 10:55 -0500, Greg Donald wrote:
> On 5/23/07, Robert Cummings <robert@xxxxxxxxxxxxx> 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.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux