[TYPO3-core] RFC: T3-speedup preg insted of ereg

Christian Jul Jensen julle at typo3.org
Sat Nov 5 12:15:50 CET 2005


On Saturday 05 November 2005 00:52, Michael Stucki wrote:
> - We all agree on using preg_ instead of ereg_ functions in the future
>   because they are much(!) faster.
>
> - We don't do that in one step, instead we just change it whenever we find
>   such a part.

yep.

> - I don't know if this has to do with refactoring, too, but I would like
> very much that every function has only one return statement. This makes the
> function much easier to debug!

I don't agree with this, sometimes you actually save a lot of assigning things 
and adding variables that are only used to bypass something that should not 
happen because you already determined your return value. So I think it can 
add unncessarily to the complexity of the code.

I don't think it's a refactoring principle, but more style of coding. What is 
important though imho is to keep a stirct signature for the function, ie. 
only one return value type.

> - Kasper checks for empty strings using strcmp, you make a "===" check
> instead. Is there any difference between them? Which of those methods is
> faster?

I didn't look into the code but remember that strcmp and === are not 
equivavalent strcmp is binary safe, but does not check the type of the 
parameters, but does on-the-fly casting.

ie

(strcmp('2',2)===0)  => true

'2'===2 => false


-- 
Christian Jul Jensen

TYPO3 association
http://association.typo3.org

* this mail is signed with GnuPG. If all you 
* see is a file of unknown type, your mail client 
* does not support it, just ignore it, it is not
* a virus, or have a look at http://openpgp.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20051105/aa5a4876/attachment.pgp 


More information about the TYPO3-team-core mailing list