-1

I get this error:

Parse error: syntax error, unexpected 'elseif' (T_ELSEIF) in C:\...\functions.php on line 6

This is the whole content of functions.php:

<?php
// prints the suitable string based on the chosen language
function lecho ($cs,$sk,$en) {
    global $lang;
    if ($lang=="cs") echo $cs;​
    elseif ($lang=="​sk") echo $​sk;​
    elseif ($lang=="​en") echo $​en;​​ // line 7
}
?>

What's wrong? This seams like such a basic thing!

mrk1357
  • 33
  • 1
  • 5

3 Answers3

-2

You're just missing a space: it's else if, not elseif.

Kyrth
  • 1,415
  • 2
  • 8
  • 4
-2

You need to use {'code here'} after an if/elseif/else statement. The correct way to go about this would be:

<?php
// prints the suitable string based on the chosen language
function lecho ($cs,$sk,$en) {
    global $lang;
    if ($lang=="cs") {
        echo $cs;​
    } elseif ($lang=="​sk") {
        echo $​sk;​
    } elseif ($lang=="​en") {
        echo $​en;​​
    }
}
?>
Chaost
  • 55
  • 8
-3

And it is simple. You just need to correct syntax for if/elseif

<?php
// prints the suitable string based on the chosen language
function lecho ($cs,$sk,$en) {
    global $lang;
    if ($lang=="cs") 
    {
        echo $cs;​
    }
    elseif ($lang=="​sk")
    { 
        echo $​sk;​
    }
    elseif ($lang=="​en")
    { 
        echo $​en;​​ // line 7
    }
}
?>
Trent
  • 2,909
  • 1
  • 31
  • 46