src/Braincrafted/ArrayQuery/ArrayQuery.php
public function select($select, $filters = array())
    {
        if (false === is_array($select)) {
            $newSelect = [ $select => $filters ];
        } else {
            $newSelect = [];
            foreach ($select as $key => $filters) {
                if (true === is_int($key) || '*' === $key) {
                    $newSelect[$filters] = [];
                } else {
                    $newSelect[$key] = $filters;
                }
            }
        }
        $this->select = $newSelect;

        return $this;
    }
public function select($select, $filters = array())
    {
        if (false === is_array($select)) {
            $newSelect = [ $select => $filters ];
        } else {
            $newSelect = [];
            foreach ($select as $key => $filters) {
                if (true === is_int($key) || '*' === $key) {
                    $newSelect[$filters] = [];
                } else {
                    $newSelect[$key] = $filters;
                }
            }
        }
        $this->select = $newSelect;

        return $this;
    }
public function select ( $ select , $ filters = array ( ) ) { if ( false === is_array ( $ select ) ) { $ newSelect = [ $ select => $ filters ] ; } else { $ newSelect = [ ] ; foreach ( $ select as $ key => $ filters ) { if ( true === is_int ( $ key ) || '*' === $ key ) { $ newSelect [ $ filters ] = [ ] ; } else { $ newSelect [ $ key ] = $ filters ; } } } $ this -> select = $ newSelect ; return $ this ; }
The names of the fields that should be selected by the query.

Example 1: **One field**

`$query->select('name');`

Example 2: **One field with filters**

`$query->select('name', 'length')`

Example 3: **Two fields as array**

`$query->select([ 'name', 'age' ]);`

Example 4: **Two fields with filters**

`$query->select([ 'name' => [ 'replace 3,e', 'trim' ], 'bio' => 'trim' ]);`

@param mixed $select Either an array of field names or each field name as parameter

@return ArrayQuery
The names of the fields that should be selected by the query .