Separating Data

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I am getting data lines with data separated by these 5 characters:

, : ; <TAB> <whitespace>

eg.  foo,bar:baz foobar

I would like to extract foo bar baz nad foobar.

How can I parse out the data between or separated by them?


Re: Separating Data

J Huntley Palmer wrote:

Quoted text here. Click to load it
$array = preg_split("[,;:\t ]", $string, -1, PREG_SPLIT_NO_EMPTY);

The last argument takes care of consecutive delimiters.

See URL:

Site Timeline