Project

General

Profile

Feature #19512 ยป 0009656.patch

Administrator Admin, 2008-10-27 23:42

View differences:

t3lib/class.t3lib_div.php (Arbeitskopie)
* @param string Delimiter string to explode with
* @param string The string to explode
* @param boolean If set, all empty values (='') will NOT be set in output
* @param integer If positive, the result will contain a maximum of limit elements,
* if negative, all components except the last -limit are returned,
* if zero (default), the result is not limited at all
* @return array Exploded values
*/
public static function trimExplode($delim, $string, $onlyNonEmptyValues=0) {
$array = explode($delim, $string);
public static function trimExplode($delim, $string, $onlyNonEmptyValues = false, $limit = 0) {
$array = (!$limit ? explode($delim, $string) : explode($delim, $string, $limit));
// for two perfomance reasons the loop is duplicated
// a) avoid check for $onlyNonEmptyValues in foreach loop
// b) avoid unnecessary code when $onlyNonEmptyValues is not set
    (1-1/1)