getColumnMeta($i)) !== false; $i++) { $type = $columnMeta['native_type']; switch($type) { case 'DECIMAL': case 'NEWDECIMAL': case 'FLOAT': case 'DOUBLE': case 'TINY': case 'SHORT': case 'LONG': case 'LONGLONG': case 'INT24': if(isset($rows[$columnMeta['name']])){ $rows[$columnMeta['name']] = $rows[$columnMeta['name']] + 0; }else{ if(is_array($rows) || $rows instanceof \Traversable){ foreach($rows as &$row){ if(isset($row[$columnMeta['name']])){ $row[$columnMeta['name']] = $row[$columnMeta['name']] + 0; } } } } break; case 'DATETIME': case 'DATE': case 'TIMESTAMP': // convert to date type? break; // default: keep as string } } return $rows; } /** * @param $subject * * @return bool */ public static function isCountable($subject) { return (is_array($subject) || ($subject instanceof \Countable)); } }