lib/private/NaturalSort.php
/**
	 * Split the given string in chunks of numbers and strings
	 * @param string $t string
	 * @return array of strings and number chunks
	 */
Split the given string in chunks of numbers and strings
@param string $t string
@return array of strings and number chunks
Split the given string in chunks of numbers and strings @param string $t string @return array of strings and number chunks
private function naturalSortChunkify($t) {
		if (isset($this->cache[$t])) {
			return $this->cache[$t];
		}
		$tz = array();
		$x = 0;
		$y = -1;
		$n = null;
		while (isset($t[$x])) {
			$c = $t[$x];
			$m = ((!$n && $c === '.') || ($c >= '0' && $c <= '9'));
			if ($m !== $n) {
				$y++;
				$tz[$y] = '';
				$n = $m;
			}
			$tz[$y] .= $c;
			$x++;
		}
		$this->cache[$t] = $tz;
		return $tz;
	}
private function naturalSortChunkify ( $ t ) { if ( isset ( $ this -> cache [ $ t ] ) ) { return $ this -> cache [ $ t ] ; } $ tz = array ( ) ; $ x = 0 ; $ y = - 1 ; $ n = null ; while ( isset ( $ t [ $ x ] ) ) { $ c = $ t [ $ x ] ; $ m = ( ( ! $ n && $ c === '.' ) || ( $ c >= '0' && $ c <= '9' ) ) ; if ( $ m !== $ n ) { $ y ++ ; $ tz [ $ y ] = '' ; $ n = $ m ; } $ tz [ $ y ] .= $ c ; $ x ++ ; } $ this -> cache [ $ t ] = $ tz ; return $ tz ; }
Split the given string in chunks of numbers and strings
 @param string $t string
 @return array of strings and number chunks
Split the given string in chunks of numbers and strings @param string $t string @return array of strings and number chunks
// Adapted and ported to PHP from // http://my.opera.com/GreyWyvern/blog/show.dml/1671288 // only include the dot in strings // next chunk