public static function sortByField($array, $field, $sort = 'asc')
	{	
		// if $array, $field, and $sort are given
		if ($array !== null && $field !== null && $sort !== null) {
			// if $array is actually an array
			if (is_array($array)) {
				// if $field is a string
				if (is_string($field)) {
					// if $sort is a string
					if (is_string($sort)) {
						// if $sort is a valid sort
						if (in_array(strtolower($sort), array('asc', 'ascending', 'desc', 'descending'))) {
							// if $array is an array of arrays with $field key
							$passed = array_filter($array, function ($v) use ($field) {
								return is_array($v) && array_key_exists($field, $v);
							});
							if (count($array) === count($passed)) {
								// sort the array using the field's value
								// by default, usort() will return results in ascending order
								//
								usort($array, function ($a, $b) use ($field) {
									if ($a[$field] < $b[$field]) {
										return -1;
									} elseif ($a[$field] > $b[$field]) {
										return 1;
									} else {
										return 0;
									}
								});
								// if the sort order is descending
								$sort = strtolower($sort);
								if ($sort === 'desc' || $sort === 'descending') {
									$array = array_reverse($array);
								}
							} else {
								throw new \InvalidArgumentException(
									__METHOD__."() expects parameter one to be an array of arrays with the key '$field'"
								);
							}
						} else {
							throw new \InvalidArgumentException(
								__METHOD__."() expects parameter three, sort, to be 'asc[ending]' or 'desc[ending]'"
							);
						}
					} else {
						throw new \InvalidArgumentException(
							__METHOD__."() expects parameter three, sort, to be a string sort order"
						);
					}
				} else {
					throw new \InvalidArgumentException(
						__METHOD__."() expects parameter two, field, to be a string field name"
					);
				}
			} else {
				throw new \InvalidArgumentException(
					__METHOD__."() expects parameter one, array, to be an array"
				);
			}
		} else {
			throw new \BadMethodCallException(
				__METHOD__."() expects two or three parameters"
			);
		}
		
		return $array;
	}