[TYPO3-core] RFC #15002: Enhancement of t3lib_div::isFirstPartOfStr
Dmitry Dulepov
dmitry at typo3.org
Wed Jul 7 09:24:15 CEST 2010
Hi!
Xavier Perseguers wrote:
>> 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.
What about:
function isFirstPartOfStrNew ($str, $partStr) {
return $partStr !== '' && strpos($str, $partStr, 0) === 0;
}
--
Dmitry Dulepov
TYPO3 core&security teams member
Twitter: http://twitter.com/dmitryd
Read more @ http://dmitry-dulepov.com/
More information about the TYPO3-team-core
mailing list