I'm a little rusty with PHP, and im trying to convert a series of variables that are currently characters into numbres. I have this code, and I'm having trouble getting it to work via trial and error. It is telling me "unexpected =" on the first case of the switch statement.
Is there perhaps a better way to do this? I'm looking to expand this out to convert 18 variables from letters to numbers. Thanks.
<?
$q1 = a;
$q2 = d;
for ($i = 1; $i <= 2; $i++)
{
switch ("$.'q'.$i")
{
case a: "$.'q'.$i" = "1"; break;
case b: "$.'q'.$i"="2"; break;
case c: "$.'q'.$i"="3"; break;
case d: "$.'q'.$i"="4"; break;
case e: "$.'q'.$i"="5"; break;
case f: "$.'q'.$i"="6"; break;
case g: "$.'q'.$i"="7"; break;
case h: "$.'q'.$i"="8"; break;
case i: "$.'q'.$i"="9"; break;
default: "$.'q'.$i"="0";
}
echo "$.'q'.$i";
}
/?>