Jump to content

Archived

This topic is now archived and is closed to further replies.

Uncannytable

Please i need help!!!

Recommended Posts

[color=blue]Whem i test a file the server says that there is a parse error on the while part, but I can't see the error. could someone help me?

this is a part of my page:[/color]

function letras($i)
{
switch ($i)
{
case 0:
$letraA = "A";
break;
case 1:
$letraA = "B";
break;
case 2:
$letraA = "C";
break;
case 3:
$letraA = "D";
break;
case 4:
$letraA = "E";
break;
case 5:
$letraA = "F";
break;
case 6:
$letraA = "G";
break;
case 7:
$letraA = "H";
break;
case 8:
$letraA = "I";
break;
case 9:
$letraA = "J";
break;
case 10:
$letraA = "K";
break;
case 11:
$letraA = "L";
break;
case 12:
$letraA = "M";
break;
case 13:
$letraA = "N";
break;
case 14:
$letraA = "O";
break;
case 15:
$letraA = "P";
break;
case 16:
$letraA = "Q";
break;
case 17:
$letraA = "R";
break;
case 18:
$letraA = "S";
break;
case 19:
$letraA = "T";
break;
case 20:
$letraA = "U";
break;
case 21:
$letraA = "V";
break;
case 22:
$letraA = "W";
break;
case 23:
$letraA = "X";
break;
case 24:
$letraA = "Y";
break;
case 25:
$letraA = "Z";
break;
}
return $letraA;
}
$i = 0
[color=blue]# on the line below there is an error that i cant see...[/color]
while ($i < 26)
{
$letraA = letras ($i);
switch ($vi[$i])
{
case 0:
$linha = str_replace ("A", "$letraA", $linha);
break;
case 1:
$linha = str_replace ("B", "$letraA", $linha);
break;
case 2:
$linha = str_replace ("C", "$letraA", $linha);
break;
case 3:
$linha = str_replace ("D", "$letraA", $linha);
break;
case 4:
$linha = str_replace ("E", "$letraA", $linha);
break;
case 5:
$linha = str_replace ("F", "$letraA", $linha);
break;
case 6:
$linha = str_replace ("G", "$letraA", $linha);
break;
case 7:
$linha = str_replace ("H", "$letraA", $linha);
break;
case 8:
$linha = str_replace ("I", "$letraA", $linha);
break;
case 9:
$linha = str_replace ("J", "$letraA", $linha);
break;
case 10:
$linha = str_replace ("K", "$letraA", $linha);
break;
case 11:
$linha = str_replace ("L", "$letraA", $linha);
break;
case 12:
$linha = str_replace ("M", "$letraA", $linha);
break;
case 13:
$linha = str_replace ("N", "$letraA", $linha);
break;
case 14:
$linha = str_replace ("O", "$letraA", $linha);
break;
case 15:
$linha = str_replace ("P", "$letraA", $linha);
break;
case 16:
$linha = str_replace ("Q", "$letraA", $linha);
break;
case 17:
$linha = str_replace ("R", "$letraA", $linha);
break;
case 18:
$linha = str_replace ("S", "$letraA", $linha);
break;
case 19:
$linha = str_replace ("T", "$letraA", $linha);
break;
case 20:
$linha = str_replace ("U", "$letraA", $linha);
break;
case 21:
$linha = str_replace ("V", "$letraA", $linha);
break;
case 22:
$linha = str_replace ("W", "$letraA", $linha);
break;
case 23:
$linha = str_replace ("X", "$letraA", $linha);
break;
case 24:
$linha = str_replace ("Y", "$letraA", $linha);
break;
case 25:
$linha = str_replace ("Z", "$letraA", $linha);
break;
}
$i = $i + 1;
}
echo $linha;

Share this post


Link to post
Share on other sites
First off, what are you trying to do? It looks highly inefficient.

Share this post


Link to post
Share on other sites
change

[code=php:0]$i = 0[/code]

to

[code=php:0]$i = 0;[/code]

Note - the colon at the end of the line.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.