Well, based off what the string is you have to work with, then there's two ways you could do it...
Case 1: You can change the string to be something like "1, 1, 2, 3"...
You can use the function explode()
$var1 = "1, 1, 2, 3, 4, 1, 4, 2";
$var2 = explode(", ", $var1);
The first parameter is the seperator (", ")
The second parameter is the string you're exploding ($var1)
The result would be...
$var[0] = 1;
$var[1] = 1;
$var[2] = 2;
etc....
Case 2: You have to use the string in that format (meaning "array(1, 1, 2, 3)")
If you're going to use it in that exact form you can use...
$var1 = "array(1, 1, 2, 3)";
$var1 = substr($var1, 6, -1);
$var2 = explode(", ", $var1);
By using the function substr(), you're taking all the data after the 6 character, everything after 'array(', and before the last character ')'. This leaves you with..
$var1 = "1, 1, 2, 3";
If you have some arbitrary string surrounding your data, then you can use this method.
$var1 = "lotsadata[1, 1, 2, 3]";
$begindata = strpos($var1, "[");
$enddata = strpos($var1, "]");
$var1 = substr($var1, $begindata, $enddata);
$var2 = explode(", ", $var1);
The result is...
$var2[0] = 1;
$var2[1] = 1;
$var2[2] = 2;
$var2[3] = 3;
This method uses strpos() to find the position of the characters that denotes the beginning and end of your data, in this case '[' and ']'. NOTE: This will not work if the characters used to indicate start and end of your data are not unique. strpos() detects the first occurence of the character in the string, so doing something like...
$var1 = "data:1:1:2:3:";
$begindata = strpos($var1, ":");
$enddata = strpos($var1, ":");
$var1 = substr($var1, $begindata, $enddata);
...would not work.
Your best bet is to just change the first method to fit your specific string. I apologize if I rambled unnecessarily
Chris