[TYPO3-core] RFC #15002: Enhancement of t3lib_div::isFirstPartOfStr

Xavier Perseguers typo3 at perseguers.ch
Mon Jul 5 22:40:09 CEST 2010


Hi,

> I am not sure if this still matches the CGL, but I would write the
> function like this:
>
> function isFirstPartOfStrNew ($str, $partStr) {
>     return (boolean)($partStr !== ''&&  strpos($str, $partStr, 0) === 0);
> }
>
> This is as fast as the first given function. see test below.

I find it quite unreadable. If this is as fast, then use the first given 
function which is absolutely clear.

Cheers
Xavier


More information about the TYPO3-team-core mailing list