Page 1 of 1

Parsing a Variable

Posted: Fri Apr 09, 2004 11:45 am
by JohnDigweed
i have a variable called

$var="150, 2, 2";

I want to split those 3 numbers into seperate variables. How would I go about doing that?

Thanks.

Posted: Fri Apr 09, 2004 12:11 pm
by markl999
$vars = explode(',', $var);
foreach($vars as $number){
echo trim($number);
}