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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:35:47+00:00 2026-05-27T17:35:47+00:00

I jus’t can’t wrap my head around this. What I’m missing is the logical

  • 0

I jus’t can’t wrap my head around this. What I’m missing is the logical bit.

I have this $myArray :

array(3) {
  [0]=>
  array(2) {
    ["lang"]=>
    string(4) "en"
    ["url"]=>
    string(42) "http://feeds.feedburner.com/wordpress/haJM"
  }
  [1]=>
  array(2) {
    ["lang"]=>
    string(4) "en"
    ["url"]=>
    string(37) "http://feeds.feedburner.com/hackaday/LgoM"
  }
  [2]=>
  array(2) {
    ["lang"]=>
    string(4) "klingon"
    ["url"]=>
    string(36) "http://www.maitre-eolas.fr/feed/atom"
  }
}

So one array of unknown size, and each element is an array of know size, (2 key / value pairs (lang = something & url = something) the whole point is not knowing what lang is. It can really be any (alphanumerical) value.

And what I’d like to do is to build a new, clean array where keys are sorted by their name, like this :

array(2) {
  [0]=>
  array(2) {
    ["lang"]=>
    string(2) "en"
    ["urls"]=>
array(2) {
  string(42) "http://feeds.feedburner.com/wordpress/haJM"
  string(37) "http://feeds.feedburner.com/hackaday/LgoM"
}
  }
  [1]=>
  array(2) {
    ["lang"]=>
    string(6) "klingon"
    ["urls"]=>
array(1) {
  string(36) "http://www.maitre-eolas.fr/feed/atom"
}
  }
}

But when I try to put the first $myArray[0][‘lang’] in a variable and compare it with the following, it… Works. Once. And stops.

I’m doing it wrong, I know it.

  • 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-27T17:35:47+00:00Added an answer on May 27, 2026 at 5:35 pm

    Try this:

    $aResult = array();
    foreach($aInput as $aRow){
        $aResult[$aRow['lang']][] = $aRow['url'];
    
    }
    

    That would give you:

    array:
      'Klingon' 
          'URL1' 
          'URL2' 
      'en' 
          'URL1' 
          'URL2'
    

    Do you really need the format listed above? Or will this do as well?

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

Sidebar

Related Questions

Jus check out this program.Logically it seems fine but its giving 000000000000000000000 for everything
I'm already tossing around a solution but as I haven't done something like this
How can I parse my CSV file without parsing first line ? This class
I have a program i frequently use that is made with .NET. This program
Ive created an array of buttons with out using the designer. cellBut[i][j]=new QPushButton(); connect(cellBut[i][j],SIGNAL(clicked()),this,SLOT(onClickAction()));
So I have been stuck for a couple of hours trying to get this
I know that using .net VSTO there is no way to do this. but
I need a solution for this: How to intercept ISet.Add method so I don't
Now I have a 1-dimonsion NSArray, each element of which is a NSMangedObject with
My app has a singleton class called CycleManager. I have created a sealed class

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.