Re: Arrays (simple)

From: Date: Fri, 27 Oct 2000 01:35:11 +0000
Subject: Re: Arrays (simple)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-22248@lists.php.net to get a copy of this message
On Fri, 27 Oct 2000, o.cook@etoncollege.org.uk wrote: > I expect this one is very simple, but I would appreciate it if someone could > suggest what functions I should > use to achieve this. > > I will be passing a large amount of text to a script in the following > format: > > An Artist - A Song Title > Another Artist - Another Song Title > ... > > When passed to the script all of that will be in one variable; what would be > the best way of getting > each line to be a new item in an associative array? > > Many thanks for any pointers, > > Best regards, > > Ollie You could try explode using newline (\n) as the character on which to split; if this doesn't work maybe preg_split will be needed. But either of these methods will only give you a scalar array. -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#22248) next »