[TYPO3-core] RFC #9779: t3lib_div::trimExplode limit parameter leads to wrong result with non-empty requirement
Xavier Perseguers
typo3 at perseguers.ch
Tue Mar 10 16:14:06 CET 2009
Hi Ingo,
>> $str = 'my,d2,8m,emt,masd2';
>> $arr = explode(',', $str, 2);
>>
>> results in
>>
>> array(
>> 0 => my
>> 1 => d2,8m,emt,masd2
>> )
>
> right, that's what explode does, but to me is quite ilogical and I
> couldn't think of a situation in real life where this could be useful.
I needed it some days ago in following situation: I have a path, let's say
$path = 'extension/some/relative/path';
and I want to extract the name of the extension and get the path:
$parts = explode('/', $path, 2);
// $parts[0] => 'extension'
// $parts[1] => 'some/relative/path';
very useful indeed!
--
Xavier Perseguers
http://xavier.perseguers.ch/en/tutorials/typo3.html
More information about the TYPO3-team-core
mailing list