I have something like the following :

$text = "<HIDDEN>0</HIDDEN><HIDDEN>1</HIDDEN>";

//Suppose that the array $hidden contains a list of strings
....

$pos = 0;
while (eregi("<HIDDEN>[0-9]+</HIDDEN>",$text,$val)) {

$text = str_replace($val[0], $hidden[$pos], $text);
$pos++;
}

Here, I'd like to do something like:
$text = str_replace($val[0], $hidden[$val[0]], $text);

so that I get the correct string from the $hidden array... The problem
is that $val[0] actually is a string while the $hidden array is
indexed by numbers (0 points to first string, 1 to second, and so
on...)

echo $val[0]; will display "0" or "1"
echo intval($val[0]) will always display 0

I tried using (int) $val[0] and settype($val[0], "integer") but that
gives the same results...

Any ideas... ?

Thank you for your time and help !