fuel/fuel/core/classes/database/result.php
public function as_array($key = null, $value = null)
	{
		$results = array();

		if ($key === null and $value === null)
		{
			// Indexed rows

			foreach ($this as $row)
			{
				$results[] = $row;
			}
		}
		elseif ($key === null)
		{
			// Indexed columns

			if ($this->_as_object)
			{
				foreach ($this as $row)
				{
					$results[] = $row->$value;
				}
			}
			else
			{
				foreach ($this as $row)
				{
					$results[] = $row[$value];
				}
			}
		}
		elseif ($value === null)
		{
			// Associative rows

			if ($this->_as_object)
			{
				foreach ($this as $row)
				{
					$results[$row->$key] = $row;
				}
			}
			else
			{
				foreach ($this as $row)
				{
					$results[$row[$key]] = $row;
				}
			}
		}
		else
		{
			// Associative columns

			if ($this->_as_object)
			{
				foreach ($this as $row)
				{
					$results[$row->$key] = $row->$value;
				}
			}
			else
			{
				foreach ($this as $row)
				{
					$results[$row[$key]] = $row[$value];
				}
			}
		}

		$this->rewind();

		return $results;
	}
public function as_array($key = null, $value = null)
	{
		$results = array();

		if ($key === null and $value === null)
		{
			// Indexed rows

			foreach ($this as $row)
			{
				$results[] = $row;
			}
		}
		elseif ($key === null)
		{
			// Indexed columns

			if ($this->_as_object)
			{
				foreach ($this as $row)
				{
					$results[] = $row->$value;
				}
			}
			else
			{
				foreach ($this as $row)
				{
					$results[] = $row[$value];
				}
			}
		}
		elseif ($value === null)
		{
			// Associative rows

			if ($this->_as_object)
			{
				foreach ($this as $row)
				{
					$results[$row->$key] = $row;
				}
			}
			else
			{
				foreach ($this as $row)
				{
					$results[$row[$key]] = $row;
				}
			}
		}
		else
		{
			// Associative columns

			if ($this->_as_object)
			{
				foreach ($this as $row)
				{
					$results[$row->$key] = $row->$value;
				}
			}
			else
			{
				foreach ($this as $row)
				{
					$results[$row[$key]] = $row[$value];
				}
			}
		}

		$this->rewind();

		return $results;
	}
public function as_array ( $ key = null , $ value = null ) { $ results = array ( ) ; if ( $ key === null and $ value === null ) { // Indexed rows foreach ( $ this as $ row ) { $ results [ ] = $ row ; } } elseif ( $ key === null ) { // Indexed columns if ( $ this -> _as_object ) { foreach ( $ this as $ row ) { $ results [ ] = $ row -> $ value ; } } else { foreach ( $ this as $ row ) { $ results [ ] = $ row [ $ value ] ; } } } elseif ( $ value === null ) { // Associative rows if ( $ this -> _as_object ) { foreach ( $ this as $ row ) { $ results [ $ row -> $ key ] = $ row ; } } else { foreach ( $ this as $ row ) { $ results [ $ row [ $ key ] ] = $ row ; } } } else { // Associative columns if ( $ this -> _as_object ) { foreach ( $ this as $ row ) { $ results [ $ row -> $ key ] = $ row -> $ value ; } } else { foreach ( $ this as $ row ) { $ results [ $ row [ $ key ] ] = $ row [ $ value ] ; } } } $ this -> rewind ( ) ; return $ results ; }
Return all of the rows in the result as an array.

// Indexed array of all rows
$rows = $result->as_array();

// Associative array of rows by "id"
$rows = $result->as_array('id');

// Associative array of rows, "id" => "name"
$rows = $result->as_array('id', 'name');

@param   string  column for associative keys
@param   string  column for values
@return  array
Return all of the rows in the result as an array .