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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:51:42+00:00 2026-05-13T19:51:42+00:00

I use a encoded string as a key in array, and also uses the

  • 0

I use a encoded string as a key in array, and also uses the same string as a value in the array, like below code indicates:

$string = 'something in some encode';
$list = array();
$list[$string]['name'] = $string;

when I print_r the array out(just print_r without headers/encoding specific), found that the key in the array and it’s ‘name’ value are not as printed as a same string, it seems to have different encoding.

I’m doing this with chinese character. In php.ini I don’t have specific encoding line(Don’t know whether it has anything to do with this).

Is there anything about the string encoding in Array keys? Or just I got them in a wrong way? Thanks for your help.

  • 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-13T19:51:42+00:00Added an answer on May 13, 2026 at 7:51 pm

    I tried in Japanese (as is what I can test):

    $test["要"]["name"] = "要";
    print_r($test);
    

    And the result went fine, as expected.
    I’m using UTF-8 for everything. I’m not sure if its a problem with your encoding settings (in php.ini) or the encoding you are using. if that is a problem, why don’t you try to encode it with base64? (or other Ascii encoder). That way would be something like:

    $test["6KaB"]["name"] = "要";
    

    I’m not sure what is your goal, so let me know if it was useful.

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

Sidebar

Ask A Question

Stats

  • Questions 308k
  • Answers 308k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This should work in your view: <%= this.ViewContext.RouteData.Values["id"] %> (assuming… May 13, 2026 at 9:38 pm
  • Editorial Team
    Editorial Team added an answer The thing is that you set only 1 imageObj and… May 13, 2026 at 9:38 pm
  • Editorial Team
    Editorial Team added an answer Iterate through keys & values: for (var k:Object in dictionary)… May 13, 2026 at 9:38 pm

Related Questions

I have the following code to encrypt a value (listed below). Now I would
I'm looking for an two-way encryption algorithm to encode an array as a string,
when using cURL in php to send data in a POST, you use set
We recently came across some sample code from a vendor for hashing a secret
I'm using the Google App Engine in combination with the Google Web Toolkit to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.