/*
For all i can see here the variable
$string
is actually not a string but an integer ?
in that case a simple and very trivial way to let it work is this way:
*/
$string = 1234;
$variable = &$string; // just to avoid inconvenience :-)
$variable = "" + $variable; // converts into string, and string is actually an array of characters
foreach ( $string as $char )
$array [ 0 ] = $char;
/*try it.
it might not be what your looking for.
good luck
drm
*/