Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6343407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:25:48+00:00 2026-05-24T20:25:48+00:00

Once upon a time, in a land far, far away, was a town called

  • 0

Once upon a time, in a land far, far away, was a town called “$languages.” In this town lived many little “$language“s – some big, some small, some well-fed, some skinny… it was the variety of the “$language“s that made the town so great.

Once a year, the little “$language“s would, one by one, sojourn to a strange and marvelous place. In this strange place, every language became equally minuscule, and a strange thing – some called it a “$qfactor,” (but no one knew why) came out of them. For some, it was altogether missing, and they became one. Sometimes, it was malformed – in which case the “$language” would be promptly sent running home.

Then, every last little “$language” would walk through a magical gateway (called The Great if). This gateway that caused great consternation to those “$language“s who passed through it, as it would determine whether or not they were one of the “$accepted“. These “$accepted” would be magically whisked away, to a place no-one knew and no-one dared to (or could?) speak of – for, strangely, the next day, every “$language,” would be found returned to his home.

Then, one day, the if became broken, and each and every “$language” would be quite rudely spit out as a foreign voice declared: Notice: Undefined variable: langauge in /var/www/nginx-default/path/to/lib/http/languages.php.

TL:DR;

foreach ($raw_languages as $language_value) {
    $language = '';

    $language_values = explode(';', $language_value);

    // If the qfactor was not supplied
    if (count($language_values) == 1) {
        // Lower-case the language
        $language = strtolower($language_values[0]);
        // Default to a q-factor of one
        $qfactor = 1;
    // If the qfactor was supplied
    } else {
        $language = strtolower($language_values[0]);
        $qfactor = $language_values[1];

        // Validate the q-factor
        if (!is_numeric($qfactor)) {
            // If it's not numeric (invalid) skip it
            continue;
        }
    }

    // If this isn't one of the accepted languages, skip it.
    if (!in_array($langauge, $accepted)) {
        continue;
    }

    // Add it to the languages array
    $languages[$language] = $qfactor;
}

For some reason, upon if (!in_array($language, $accepted), I get an error stating: `Notice: Undefined variable: langauge in /var/www/nginx-default/path/to/lib/http/languages.php. The strange thing is that I can even sneak in a call to print() on the same line (by putting it in the if statement) and I will not get the same error – in fact, doing so gives the expected output!

I am greatly confused as to why this could be happening (and rather bored because of the work it’s blocking, as you can see by the story), so any help would be appreciated.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T20:25:49+00:00Added an answer on May 24, 2026 at 8:25 pm

    You spelt language wrong:

    if (!in_array($langauge, $accepted)) {
            continue;
    }
    

    Swap the a and u in $langauge 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Once upon a time, far far away in a distant galaxy I was a
I got stumbled upon this issue once and I guess I need some expertise
Once upon a time there is netbeans plugin called Developer Collaboration which allows you
I came across this kind of table layout once upon a time (Unfortunately, I
The following code is called once upon applicationDidFinishLaunching: ; however, it runs each time
Ok, so once upon a time, my code worked. Since then I did some
I wrote this code : HTML <p> Once upon a time there was a
Once upon a time, I remember running some TSQL which would display which network
Once upon a time, I had a DropDownList with Options built using this code:
I ran across something once upon a time and wondered if it was a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.