Simple Answer:
<?php
$string = "Bill,Martin,Joe";
list($name1, $name2, $name3) = explode(",", $string);
?>
Complicated, for any number of varibles:
<?php
$string = "Bill,Martin,Joe";
$names = explode(",", $string);
for($i = 0; $i < count($names); $i++)
{
eval('$name'.($i+1).' = "'.$names[$i].'";');
}
print $name1; // Prints 'Bill'
print $name2; // Prints 'Martin'
print $name3; // Prints 'Joe'
?>
hope it helps,
Vasilis
"Trevor" <tr*********@gmail.com> wrote in message news:<11**********************@l41g2000cwc.googleg roups.com>...
Say I've got this:
<?php
$string = "Bill,Martin,Joe";
$name1
$name2
$name3
?>
How do I make the $name1 equal to the first name in the list of
strings, $name2 the second and so on?
Thank You,
Trevor