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

The Archive Base Latest Questions

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

Hi I have a list of values named: $value1 $value2 $value3 … and I’d

  • 0

Hi I have a list of values named:

  • $value1
  • $value2
  • $value3
  • …

and I’d like to assign each value to an array element; something like:

$my_array[1]=$value1;
$my_array[2]=$value2;
$my_array[3]=$value3;

How can I do this using a for cycle? The array is not a problem but I can’t figure out how to write some code for the value, it should be something like:

for($i=1; $i<=10000; $i++)
{
    $my_array[$i]=$value$i;
}
  • 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:28:05+00:00Added an answer on May 27, 2026 at 12:28 pm

    Try this:

    for ($i=1; $i<=10000; $i++) {
        $val_name = "value" . $i;
        $my_array[$i]=$$val_name;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list like this: <select name=select_list_name id=list_id> <option value=>Select Option</option> <option value=value1>Option
I have a List with array of object values. I have to display value
I have an array named Floors in class A, it contains values something like
I have a dropdown list that stores name/value pairs. The dropdown appears in each
Suppose I have a list box with different items, each with unique values, and
I have a JSON object like such: var list = {'name1' : {'element1': 'value1'},
I have an XML file with this structure: <?xml version=1.0> <person> <element att1=value1 att2=value2>Anonymous</element>
I have a large list of non-unique named values, i.e.: tscores 11461 11461 11461
Ok. So I have a list of values, and I'd like to do something
I have a list of values in a SQL Table which are used to

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.