src/extensions/DatatypeTrait.php
public function getDatatypes() {
        if (empty($this->data)) {
            $this->data = $this->parse_string();
        }
        if (!is_array($this->data)) {
            throw new \UnexpectedValueException('No data set yet.');
        }

        $result = [];
        foreach ($this->titles as $cName) {
            $column = array_column($this->data, $cName);
            $cDatatypes = array_map(DatatypeEnum::class . '::getValidTypeFromSample', $column);

            $result[$cName] = $this->getMostFrequentDatatypeForColumn($cDatatypes);
        }

        $this->data_types = $result;

        return !empty($this->data_types) ? $this->data_types : [];
    }
public function getDatatypes() {
        if (empty($this->data)) {
            $this->data = $this->parse_string();
        }
        if (!is_array($this->data)) {
            throw new \UnexpectedValueException('No data set yet.');
        }

        $result = [];
        foreach ($this->titles as $cName) {
            $column = array_column($this->data, $cName);
            $cDatatypes = array_map(DatatypeEnum::class . '::getValidTypeFromSample', $column);

            $result[$cName] = $this->getMostFrequentDatatypeForColumn($cDatatypes);
        }

        $this->data_types = $result;

        return !empty($this->data_types) ? $this->data_types : [];
    }
public function getDatatypes ( ) { if ( empty ( $ this -> data ) ) { $ this -> data = $ this -> parse_string ( ) ; } if ( ! is_array ( $ this -> data ) ) { throw new \ UnexpectedValueException ( 'No data set yet.' ) ; } $ result = [ ] ; foreach ( $ this -> titles as $ cName ) { $ column = array_column ( $ this -> data , $ cName ) ; $ cDatatypes = array_map ( DatatypeEnum :: class . '::getValidTypeFromSample' , $ column ) ; $ result [ $ cName ] = $ this -> getMostFrequentDatatypeForColumn ( $ cDatatypes ) ; } $ this -> data_types = $ result ; return ! empty ( $ this -> data_types ) ? $ this -> data_types : [ ] ; }
Check data type foreach Column
Check data type for each column and returns the most commonly.

Requires PHP >= 5.5

@uses   DatatypeEnum::getValidTypeFromSample

@return array|bool
Check data type foreach Column Check data type for each column and returns the most commonly .