src/Csv.php
public function toIndexed($data, $fillMissing = false) {
	foreach ($data as $key => $value) {
		if(!in_array($key, $this->headers)) {
			throw new InvalidFieldException($key);
		}
		$headerIndex = (int)array_search($key, $this->headers);
		$data[$headerIndex] = $value;
		unset($data[$key]);
	}

	ksort($data);

	if($fillMissing) {
		$data = $this->fillMissing($data);
	}
	return $data;
}
public function toIndexed($data, $fillMissing = false) {
	foreach ($data as $key => $value) {
		if(!in_array($key, $this->headers)) {
			throw new InvalidFieldException($key);
		}
		$headerIndex = (int)array_search($key, $this->headers);
		$data[$headerIndex] = $value;
		unset($data[$key]);
	}

	ksort($data);

	if($fillMissing) {
		$data = $this->fillMissing($data);
	}
	return $data;
}
public function toIndexed ( $ data , $ fillMissing = false ) { foreach ( $ data as $ key => $ value ) { if ( ! in_array ( $ key , $ this -> headers ) ) { throw new InvalidFieldException ( $ key ) ; } $ headerIndex = ( int ) array_search ( $ key , $ this -> headers ) ; $ data [ $ headerIndex ] = $ value ; unset ( $ data [ $ key ] ) ; } ksort ( $ data ) ; if ( $ fillMissing ) { $ data = $ this -> fillMissing ( $ data ) ; } return $ data ; }
Converts an associative array into an indexed array, according to the
currently stored headers.

@param array $data Associative array of data representing row
@param bool $fillMissing True to fill missing indices

@return array Indexed array of data in order of columns
Converts an associative array into an indexed array according to the currently stored headers .