lib/Helper.php
public static function pluck( $array, $key ) {
		$return = array();
		foreach ( $array as $obj ) {
			if ( is_object($obj) && method_exists($obj, $key) ) {
				$return[] = $obj->$key();
			} elseif ( is_object($obj) && property_exists($obj, $key) ) {
				$return[] = $obj->$key;
			} elseif ( is_array($obj) && isset($obj[$key]) ) {
				$return[] = $obj[$key];
			}
		}
		return $return;
	}
public static function pluck( $array, $key ) {
		$return = array();
		foreach ( $array as $obj ) {
			if ( is_object($obj) && method_exists($obj, $key) ) {
				$return[] = $obj->$key();
			} elseif ( is_object($obj) && property_exists($obj, $key) ) {
				$return[] = $obj->$key;
			} elseif ( is_array($obj) && isset($obj[$key]) ) {
				$return[] = $obj[$key];
			}
		}
		return $return;
	}
public static function pluck ( $ array , $ key ) { $ return = array ( ) ; foreach ( $ array as $ obj ) { if ( is_object ( $ obj ) && method_exists ( $ obj , $ key ) ) { $ return [ ] = $ obj -> $ key ( ) ; } elseif ( is_object ( $ obj ) && property_exists ( $ obj , $ key ) ) { $ return [ ] = $ obj -> $ key ; } elseif ( is_array ( $ obj ) && isset ( $ obj [ $ key ] ) ) { $ return [ ] = $ obj [ $ key ] ; } } return $ return ; }
Plucks the values of a certain key from an array of objects
@param array $array
@param string $key
Plucks the values of a certain key from an array of objects