Page 1 of 1

Need help separating a row in a table into an array[solved]

Posted: Wed Apr 19, 2006 9:49 pm
by The-Master
Hi, i wanted to know how i can separate a row in a table to an array...
the row is for example: "me, you, they, us" and i want that after every "," a new array value will be made...

Code: Select all

$arr=array("one" => "me", "two" => "you", "three" => "they", "four" => us);

Posted: Wed Apr 19, 2006 10:37 pm
by feyd

Posted: Thu Apr 20, 2006 1:31 am
by The-Master
you just saved me a big amount of code lines... i wanted to do this:

Code: Select all

<?php
$num=0;
$r=...       //the database stuff... (mouse_1, mouse_2, ..._3)
$mice=$r['mice'];
$mice_total=array($mice);
foreach($mice as &$mouse) {
echo "$mouse[$num]";
++$num;
}
?>
thanks!