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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:44:40+00:00 2026-05-24T07:44:40+00:00

After hours going around in circles I gave up and ask for help. I

  • 0

After hours going around in circles I gave up and ask for help.

I have an array which looks like:

[field01] => Array
    (
        [name] => test01
        [prefix] => C01
    )

[field02] => Array
    (
        [url] => http://www.url.com
        [user] => a_user
        [password] => a_password
    )

[filed03] => Array
    (
        [0] => Array
            (
                [id] => 1
                [Type] => standard
                [Name] => name
            )

        [1] => Array
            (
                [id] => 5
                [Type] => standard
                [Name] => name
            )

    )

Now I want to go through that array and get the following output as a return from a recursive function:

Array (
    [0] = "The values of field01: name, prefix - test01, C01"
    [1] = "The values of field02: url, user, password - http://www.url.com, a_user, a_password"
    [2] = "The values of field03: id, Type, Name - 1, standard, name"
    [3] = "The values of field03: id, Type, Name - 5, standard, name"
)

I have tried it with a recursive function but stuck with field03 to save the name.

Any help for that?

UPDTAE:

here is the array, so you don’t have to write it:

$data['field01']['name'] = "field01";
$data['field01']['prefix'] = "C01";

$data['field02']['url'] = "http://www.url.com";
$data['field02']['user'] = "a_user";
$data['field02']['password'] = "a_password";

$data['field03'][0]['List_id'] = 1;
$data['field03'][0]['Type'] = "standard";
$data['field03'][0]['Name'] = "name";

$data['field03'][1]['List_id'] = 5;
$data['field03'][1]['Type'] = "standard";
$data['field03'][1]['Name'] = "name";

Thanks in advance!

  • 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-24T07:44:40+00:00Added an answer on May 24, 2026 at 7:44 am
    <?php
    
    $data['field01']['name'] = "field01";
    $data['field01']['prefix'] = "C01";
    
    $data['field02']['url'] = "http://www.url.com";
    $data['field02']['user'] = "a_user";
    $data['field02']['password'] = "a_password";
    
    $data['field03'][0]['List_id'] = 1;
    $data['field03'][0]['Type'] = "standard";
    $data['field03'][0]['Name'] = "name";
    
    $data['field03'][1]['List_id'] = 5;
    $data['field03'][1]['Type'] = "standard";
    $data['field03'][1]['Name'] = "name";
    
    $text = '';
    foreach ($data as $k => $fields) {
      if (isset($fields[0])) {
        foreach ($fields as $field) {
          $text .= 'The values of ' . $k . ': ' . traverse($field) . "\n";
        }
      } else {
        $text .= 'The values of ' . $k . ': ' . traverse($fields) . "\n";
      }
    }
    
    echo $text;
    
    
    function traverse($fields) {
      $keys = array_keys($fields);
      $values = array_values($fields);
      return implode(', ', $keys) . ' - ' . implode(', ', $values);
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Help please, After numerous hours searching for the solution to my problem i have
Alright, so after a few hours of me playing around to no avail, I
i have a question, after allot of hours in googling and reading articles, i
I have been going over this for hours and cannot find the problem. I
After three hours I'm going to stop banging my head on the wall and
EDIT: After spending several hours researching this, I don't think I'm going to find
In goofing around with some F# (via MonoDevelop), I have written a routine which
I can't figure out what it is going on here...after hours... This is the
I have been looking around for a few hours trying to figure out how
I'm just realising after 24 hours of jquery/javascript pain, that maybe i'm going the

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.