Re: Suggestion to zend-api: some lookahead could make functions calls faster!

From: Date: Tue, 16 Nov 1999 20:03:04 +0000
Subject: Re: Suggestion to zend-api: some lookahead could make functions calls faster!
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-6315@lists.php.net to get a copy of this message
On Tue, 16 Nov 1999, Andi Gutmans wrote: > At 07:33 PM 11/15/99 +0100, Thies C. Arntzen wrote: > >hi, > >just an idea: > > > >if a c-function knew the the returned value will be discarded by the > >caller (the script) there would be no need to set up > >return_value. > > > >reset() for example returns a copy of the 1st array element. i never use > >that... > > > >reset($arr); // no need to copy 1st array element into return_value > > > >$first = reset($arr); // set up return_value > > This sounds like a pretty good idea. I'll try and take the time to > implement this. > > >even smarter libzend could pass a flag to a c-function telling that the > >return-value will just be used as a bool: > > > >$a = key($array); // key() needs to create the return_value completely > > > >if (key($array)) // resturn_value could just be true/false > > { > > } > > Forget it :) nice try though? > > > >i'd also like a new set of first(), current(), next() etc functions that > >return a reference to the corresponding array element instead of a copy - > >something like r_first() would be ugly - how about &first()? > > You can't use &first as a function name. I don't like the first(), > current(), next() syntax (it only exists for PHP/FI 2 compatibility). I > think having something like each() or foreach() that works with references > is more feasible. agree. tc > > Andi > --- > Andi Gutmans <andi@zend.com> > http://www.zend.com/ > > Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!" Digital Collections Phone +49 40 235350 Fax +49 40 23535180 Hammerbrookstr. 93 20097 Hamburg / Germany

« previous php.version4 (#6315) next »