Jump to content

Archived

This topic is now archived and is closed to further replies.

matfish

Manipulating strings?

Recommended Posts

Hi,

Iv got a list such as:

Line 1
Line 2
Line 3

which I wanted to copy & paste into a text box then put them into an array as separate results. Also then display each line with a comma to output:

line 1, line 2, line 3,

Any ideas? Wanted to output the above and also put in array so I can do other stuff like put certain keywords into a database.

TIA

Share this post


Link to post
Share on other sites
look up explode() and implode() in the manual.  the former turns a string into an array based on whatever "splitting character" (called a delimiter) you want to stipulate, which in this case looks like it'd be a newline character "\n" (and/or carriage return, "\r").  implode() then does the opposite - glues together every value in an array with a certain character between each value, which in this case looks like it'd be ', '.

post back if you run into troubles or are confused about their use.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.