private static function arraySelect($fields = [], $arr) {
        $result = [];
        $values = [];
        if ($fields === []) {
            foreach ($arr as $index => $row) {
                foreach (array_keys($row) as $c) {
                    $values[$c] = $row[$c];
                }
                if ($values) {
                    $result[$index] = $values;
                }
                $values = [];
            }
        } else {
            foreach ($arr as $index => $row) {
                foreach ((array) $fields as $c) {
                    if ($row[$c]) {
                        $values[$c] = $row[$c];
                    }
                }
                if ($values) {
                    $result[$index] = $values;
                }
                $values = [];
            }
        }
        return $result;
    }
private static function arraySelect($fields = [], $arr) {
        $result = [];
        $values = [];
        if ($fields === []) {
            foreach ($arr as $index => $row) {
                foreach (array_keys($row) as $c) {
                    $values[$c] = $row[$c];
                }
                if ($values) {
                    $result[$index] = $values;
                }
                $values = [];
            }
        } else {
            foreach ($arr as $index => $row) {
                foreach ((array) $fields as $c) {
                    if ($row[$c]) {
                        $values[$c] = $row[$c];
                    }
                }
                if ($values) {
                    $result[$index] = $values;
                }
                $values = [];
            }
        }
        return $result;
    }
private static function arraySelect ( $ fields = [ ] , $ arr ) { $ result = [ ] ; $ values = [ ] ; if ( $ fields === [ ] ) { foreach ( $ arr as $ index => $ row ) { foreach ( array_keys ( $ row ) as $ c ) { $ values [ $ c ] = $ row [ $ c ] ; } if ( $ values ) { $ result [ $ index ] = $ values ; } $ values = [ ] ; } } else { foreach ( $ arr as $ index => $ row ) { foreach ( ( array ) $ fields as $ c ) { if ( $ row [ $ c ] ) { $ values [ $ c ] = $ row [ $ c ] ; } } if ( $ values ) { $ result [ $ index ] = $ values ; } $ values = [ ] ; } } return $ result ; }
Gets an array of field names against values for every member of an array.

@param array $fields the list of names of fields to get, empty for all
@param array $arr    the array to query
@return array        an array of field names against values for every member of the array
Gets an array of field names against values for every member of an array .