PDA

View Full Version : Split String Into Variables


voterone
05-10-2003, 02:51 PM
Hello,

How can I access the string that print_r($title[0]); returns, strip it of dashes, and break it down into three variables?

The result of print_r($title[0]); is returned in the following format; band name - song title - album name

I've tried;

$break_down = ($title[0]);
$break_down = explode(" - ", $break_down);

And if the above code is correct, I'm lost in how I loop through all parts and return the results.

I'm so new at this it hurts.

Thanks

Ökii
05-10-2003, 04:08 PM
$break_down = explode("-", $title[0]);

echo 'band name - ' .$break_down[0]. '<br />
song title - ' .$break_down[1]. '<br />album name - ' .$break_down[2]. '<br />';