PHP - Split Variable into 4

Status
Not open for further replies.

conor

New Member
Hi,

Is it possible to split a variable such as:

$variable = '1,2,3,4';

Into four different variables?

I have managed to split it into an array by doing this:

$array = explode(',',$variable);

But if that is the way to go about it then how can I change that into something usefull like:
$array['one'] = 1;
$array['two'] = 2;
$array['three'] = 3;
$array['four'] = 4;

I know that there will always be only four values.

Thanks
 
Status
Not open for further replies.
Top