Re: problem with if statement and language.
| From: | Jerry | Date: | Tue, 03 Oct 2000 14:48:49 +0000 |
| Subject: | Re: problem with if statement and language. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-18425@lists.php.net to get a copy of this message | ||
In article <1344101411.20001003115531@mail.viapvt.sk>,
daniel@mail.viapvt.sk (Daniel Rezny) wrote:
> Hello all,
>
> I want to try a multilingual page and now I want to create it with
> $HTTP_ACCEPT_LANGUAGE variable. So I made this:
> f ($HTTP_ACCEPT_LANGUAGE = "de") {
> if ($HTTP_ACCEPT_LANGUAGE = "en") {
>
> I have in one file default language and I included it before. And this
> is not working. If I have english computer gives me german.
>
> Some help or suggestions?
Sure. You don't specify the language, but it looks like PHP. In PHP, you
are telling the script to set $HTTP_ACCEPT_LANGUAGE to "de", and then if
that set is successful (which it should always be) to go ahead and do
the "german" section.
What you want is $HTTP_ACCEPT_LANGUAGE == "de", or, to better guard
against this error in the future, "de" == $HTTP_ACCEPT_LANGUAGE. In the
latter case, if you accidentally type "de" = $HTTP_ACCEPT_LANGUAGE, the
compiler will rightfully tell you that you cannot assign a value to a
non-variable.
Jerry