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

Michiel Roos [netcreators] michiel at netcreators.com
Wed Jul 7 09:48:05 CEST 2010


On 7/7/10 9:24 AM, Dmitry Dulepov wrote:
> 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;
> }
> 
> 

Great!

That's the quickest version yet!

:-)

Please find v7 test file attached.

-- 
Met vriendelijke groet / Warm regards,

Michiel Roos
Chief Technical Officer
Netcreators: Open Source, Open Minds, Open People
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 15002_test_v7.php
Type: text/php
Size: 3196 bytes
Desc: not available
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20100707/35c374ed/attachment.bin>


More information about the TYPO3-team-core mailing list