Since we are dealing with numbers, I would approach it differently with some simple math.
PHP Code:
function numberToArray(temp.n) {
temp.n = abs(temp.n);
temp.digits = {};
while(temp.n != 0) {
temp.digits.insert(0, temp.n % 10);
temp.n = int(temp.n/10);
}
return temp.digits;
}
function onCreated() {
temp.fullnumber = 482;
temp.digits = numberToArray(temp.fullnumber);
echo(temp.digits[0]); // 4
echo(temp.digits[1]); // 8
echo(temp.digits[3]); // 2
}
If you want it the other way (reversed), change the .insert(0, ...) with .add(...)