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

  • Home
  • SEARCH
  • 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 8692245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:16:49+00:00 2026-06-13T00:16:49+00:00

I need some help trying to implode my multidimensional array twice. I’m using Joomla

  • 0

I need some help trying to implode my multidimensional array twice. I’m using Joomla 2.5 and it’s for a backend component..

Here’s what the array is:

Array
(
    [jform] => Array
        (
            [options] => Array
                (
                    [colour] => Array
                        (
                            [0] => a
                            [1] => d
                        )

                    [size] => Array
                        (
                            [0] => b
                            [1] => e
                        )

                    [qty] => Array
                        (
                            [0] => c
                            [1] => f
                        )

                )

        )

)

I’ve tried using the following code:

$i=0;
$optchildArr = array();
$optchildArrX = array();
foreach ($this->options as $optArr) :

    $j=0;
    foreach ($optArr as $arr) :
        $optchildArrX[] = $arr;
        $j++;
    endforeach;

    $optchildArr[$i] = implode(',',$optchildArrX);
    $i++;
endforeach;

$this->options  = implode(';',$optchildArr);

But I’m getting these kind of results:

[options] => Array
        (
            [0] => a,d
            [1] => a,d,b,e
            [2] => a,d,b,e,c,f
        )

When I’m after:

[options] => Array
        (
            [0] => a,b,c
            [1] => d,e,f
        )

Any help would be greatly appreciated!! 🙂

  • 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-06-13T00:16:50+00:00Added an answer on June 13, 2026 at 12:16 am

    Assuming the main array is $A

    function mergeArrays($colour, $size, $qty) {
        $result = array();
        for ($i=0; $i<count($colour); $i++) {
            //Assuming three arrays have the same length;
            $result[] = implode(',',array($colour[$i], $size[$i], $qty[$i]));
        }
        return $result;
    }
    
    $result_array = array_map(
        'mergeArrays',
        $A['jform']['options']['colour'],
        $A['jform']['options']['size'],
        $A['jform']['options']['qty']
    );
    
    //Check the output from this, should be the output you described.
    var_dump($result_array);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help. I'm trying to upload files using <input type=file> . Here
I need some help using regex in java. Im trying to achieve 2 different
I need some help here. I'm trying to make my own content slider writing
I am trying to write a regex using perl but I need some help.
I need some help figuring out what I'm doing wrong here. I am trying
I need some help here. Whats it's problem when trying to launch WEBrick? So
I need some help I am trying to create a PHP form using sqlite3
I really need some help here, we are trying to use our player over
I am trying to optimize my MySQL queries and I need some help. Here
I need some help I am trying to create a PHP form using sqlite3

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.