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 6198991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:06:39+00:00 2026-05-24T04:06:39+00:00

I have an array of names which I am reading in from a mysql

  • 0

I have an array of names which I am reading in from a mysql table. Everything works fine, except I’ve just noticed that if the name contains any non-English characters, e.g. Scandanavian, Greek etc. this causes an error, “undefined index”.

What I don’t get though is that the names are being listed out fine in another part of my app, using the same function. The only difference being that I am passing the name specifically as a parameter when this error occurs. Other times I am just iterating through the whole list and echoing out all the names.

Each name is the array key, I’m getting the error on the line for the else return:

   if($nameParam ==""){ 
         return $listOfNames;
   }
   else{ 
         return $listOfNames[$nameParam];   
   }

Any ideas how I could fix this?

Would it be better to somehow check each name and apply some kind of encoding/decoding writing/reading to the mysql table? If so what would be the best way to do this?
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-24T04:06:40+00:00Added an answer on May 24, 2026 at 4:06 am

    I’ve looked through PHP C code for if PHP does modifies/strips unicode chars in array key strings in any way but couldn’t find any conversion logic there.
    Just to confirm this I’ve asked a question on php.net mailing list:

    Q:
    ….blah blah…I was just wondering – when unicode characteres are used in
    array key – does PHP strips them or affects them in any way?
    or does PHP simply treats keys as binary string, the end of the story?

    A:
    I believe that string array keys are treated as binary strings, and
    never modified. I couldn’t find you a source, but I’ve always worked on
    this assumption and never hit a problem. UTF-8 keys definitely work fine
    (*); I’m also not aware of any max length the keys can have (meaning you
    shouldn’t have to worry about a multi-byte character getting truncated
    in the middle).

    Thus I now believe that having whatever UTF8 characters in array keys shouldn’t affect your ability to use arrays as usual.

    ALSO

    I’m sure you already aware of this but I would check that db uses correct encoding to store data.
    In mysql I always use UTF-8 charset and utf8_general_ci collation.

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

Sidebar

Related Questions

No related questions found

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.