Facundo Aquino
Facundo Aquino

Reputation: 3

CSV data display in column format?

I have a simple csv line taked from a txt file. This line is showed by default like a simple row, like this:

125922 1 1 1 4.613 4.985 16.164 27.618 4.990 16.169

And i need show this on columns, like this:

125922
1
1
1
4.613
4.985
16.164
27.618
4.990
16.169

Someone has an idea?

My idea was using css, or a simple php code o javascript.

Upvotes: 0

Views: 163

Answers (1)

John Conde
John Conde

Reputation: 219834

str_replace() would probably do the trick since you're just switching out tabs for new lines:

echo str_replace("\t", "\n", "125922 1 1 1 4.613 4.985 16.164 27.618 4.990 16.169");

If it is being output to a web browsers use:

echo str_replace("\t", "<br>", "125922 1 1 1 4.613 4.985 16.164 27.618 4.990 16.169");

Upvotes: 1

Related Questions