Skip to content

functions_modules_textdata

Daniel Spors edited this page Feb 14, 2023 · 2 revisions

Functions in file modules/textdata.php

textdata_init

Initializes the textdata module This module provides functions for text-file processing

Definition: public function textdata_init()

Returns: void

csv_to_array

Parses CSV data into an array. See http://www.php.net/manual/de/function.str-getcsv.php#95132

Definition: public function csv_to_array($csv, $delimiter=false, $enclosure, $escape, $callback=false)

Returns: array An array with one entry per line, each beeing an array of fields

Parameters:

  • string $csv CSV data as string

  • string $delimiter CSV delimiter used

  • string $enclosure CSV enclosure string

  • string $escape CSV escape string

  • \Closure|string $callback Function to be called for each detected row

csv_header

Extracts the header from a CSV data string This is usually the first line which contains the field names.

Definition: public function csv_header($csv, $delimiter, $enclosure, $escape)

Returns: array An array with one entry per field

Parameters:

  • string $csv CSV data as string

  • string $delimiter CSV delimiter used

  • string $enclosure CSV enclosure string

  • string $escape CSV escape string

csv_detect_delimiter

Tries to detect the CSV field delimiter This may be one of: ';' ',' '|' '\t'

Definition: public function csv_detect_delimiter($csv)

Returns: string The delimiter that seems to match best

Parameters:

  • string $csv CSV data as string

remove_utf8_bom

Removes the BOM header from a string.

Definition: public function remove_utf8_bom($text)

Returns: string Clean string

Parameters:

  • string $text Text, potentially with leading BOM
Clone this wiki locally