Re: Ternary operator enhancement for fluent code

From: Date: Wed, 05 Jul 2000 01:24:14 +0000
Subject: Re: Ternary operator enhancement for fluent code
References: 1 2 3 4 5  Groups: php.dev 
Request: Send a blank email to php-dev+get-23519@lists.php.net to get a copy of this message
> > Even if it's not part of the PHP core language, it's certainly easy to put > > it in an include file. Right now both of the functions I provide at > > http://gateway.digitaria.com/~chris/php/first_valid/ > > simply do a !empty() > > check. One function checks a list of variables and the other checks a bunch > > of arrays to find the first which has a !empty() value for a given key. It > > would take very little time to modify either function to use something other > > than !empty(). > > Sure, but if it´s part of PHP´s functions it´ll be fast,fast,faster. > I´ve various kindw of include´d var-checking functions (checking with > variable arguments, checking multi-dim arrays of vars, checking object > vars and so on...), I´m sure like you everyone has it´s own worse or > better functions... True. On the other hand, it's not as if doing it yourself is that big a deal. The two functions I referenced above (first_valid() & first_valid_in_array()) take 5 seconds and 15 seconds respectively when repeated 100,000 times with assert checking on and the zend compiler off. That drops to 3 seconds and 9 seconds for 100,000 repetitions with assert checking off and the zend compiler enabled. I have a feeling that there are other optimizations that would save more than 0.00003s.

« previous php.dev (#23519) next »