src/Support/Arr.php
/**
	 * Pluck an array of values from an array.
	 *
	 * @param array $array
	 * @param string|array $value
	 * @param string|array|null $key
	 * @return array
	 */
Pluck an array of values from an array.
Pluck an array of values from an array .
public static function pluck($array, $value, $key = null) {
		$results = array();
		list($value, $key) = static::explodePluckParameters($value, $key);
		foreach ($array as $item) {
			$itemValue = static::get($item, $value);
			if (is_null($key)) {
				$results[] = $itemValue;
			}
			else {
				$itemKey = static::get($item, $key);
				if (is_object($itemKey) && method_exists($itemKey, '__toString')) {
					$itemKey = (string) $itemKey;
				}
				$results[$itemKey] = $itemValue;
			}
		}
		return $results;
	}
public static function pluck ( $ array , $ value , $ key = null ) { $ results = array ( ) ; list ( $ value , $ key ) = static :: explodePluckParameters ( $ value , $ key ) ; foreach ( $ array as $ item ) { $ itemValue = static :: get ( $ item , $ value ) ; if ( is_null ( $ key ) ) { $ results [ ] = $ itemValue ; } else { $ itemKey = static :: get ( $ item , $ key ) ; if ( is_object ( $ itemKey ) && method_exists ( $ itemKey , '__toString' ) ) { $ itemKey = ( string ) $ itemKey ; } $ results [ $ itemKey ] = $ itemValue ; } } return $ results ; }
Pluck an array of values from an array.
Pluck an array of values from an array .