Converting Strings to Arrays

$a = explode(',', $csvdata);

Sometimes, arrays are not used to store information; instead, a string is used. The single values are all within the string, but are separated by a special character. One example for this is the comma separated values (CSV) format.

explode function syntax

array explode ( string $delimiter , string $string [, int $limit ] )

explode function splits a string by string and returns an array of strings. This function accepts three parameters:

delimiter a boundary string

string an input string

limit maximum of limit elements with the last element containing the rest of string