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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:09:28+00:00 2026-05-27T12:09:28+00:00

i have 3 arrays that i get from a dynamically generated form(there could be

  • 0

i have 3 arrays that i get from a dynamically generated form(there could be a variable number of entries but the number of entries for each of these 3 arrays will always be the same):

services[0] => $service1
services[1] => $service2
services[2] => $service3

amount[0] => $amount1
amount[1] => $amount2
amount[2] => $amount3

price[0] => $price1
price[1] => $price2
price[2] => $price3

How do i make an array for each variable of those arrays?
For each service with the same label i want to make an array called service like this:

Service1[0] => services[0]
Service1[1] => amount[0]
Service1[2] => price[0]

Service2[0] => services[1]
Service2[1] => amount[1]
Service2[2] => price[1]

Service3[0] => services[2]
Service3[1] => amount[2]
Service3[2] => price[2]

And eventually make a final array like this:

Services[0] => Service1
Services[1] => Service2
Services[2] => Service3

I could easily do it if i knew the exact number of variables i get from the form but since it’s dinamycally generated i don’t know that.
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-27T12:09:29+00:00Added an answer on May 27, 2026 at 12:09 pm
    for($i=0;$i<3;$i++){
      $Services[$i]=array($services[$i],$amount[$i],$price[$i]);
    }
    

    In php you need $ before variables.

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

Sidebar

Related Questions

I have a dynamically generated list of URL's from our internal network. For each
I have several textboxes that are generated dynamically based on some results I get
Assume that we have multiple arrays of integers. You can consider each array as
I have three arrays (it's written in C but that is not important, it
I have a form that has an array of dynamically created labels of varying
I have a problem that I tried to ask about previously, but didn't get
I have a drop down list that is dynamically generated using a mySQL database
How do I get all th resources dynamically from my current assembly? I have
I have two arrays that I would like to compare and ultimately wind up
I have 2 arrays that I would like to render in a template, one

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.