# Hello need some help with a while loop

**URL:** <https://forum.kirupa.com/t/hello-need-some-help-with-a-while-loop/301066>\
**Category:** Uncategorized\
**Created:** [December 3, 2009, 2:58am UTC](https://forum.kirupa.com/t/hello-need-some-help-with-a-while-loop/301066 "2009-12-03T02:58:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![INDE](https://avatars.discourse-cdn.com/v4/letter/i/e480ec/32.png) [@INDE](https://forum.kirupa.com/u/INDE)\
**Post date:** [December 3, 2009, 2:58am UTC](https://forum.kirupa.com/t/hello-need-some-help-with-a-while-loop/301066/1 "2009-12-03T02:58:23Z")

</div>

hi there, i think i am really tired and novice for this one…

i need some quick help and i am sure this is quick for an experienced user.

i have a script that changes the language of the page and i locate the language of the page by storing the session to a “language.tmp” file

so after i do this i have this script… to output the “english text” or “Русский текст”.

```php
<?php
    
    
$languages['Eng']="english text";
$languages['Rus']="&#1056;&#1091;&#1089;&#1089;&#1082;&#1080;&#1081; &#1090;&#1077;&#1082;&#1089;&#1090;";

$l=file_get_contents("lang.tmp");

        while (list($key, $value) = each($languages))
        {
           if($l==$key);
           echo ''.$value.'';
        }

?>

```

So the problem here is that when i run this it returns me both the values of the array “languages”, what i need is, the script outputting just the one in use, which is collected using “$l=file\_get\_contents(“lang.tmp”);” from the tmp file. The tmp file has only one value and that is “Eng” or “Rus” at a time, depending on user choise.

I understand that the problem is in the while loop but how can i get rid of it and output just the current value in use… “english text” or “Русский текст”.
