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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:16:49+00:00 2026-05-28T13:16:49+00:00

Is it possible to take an array of values, for example: $index = array(‘0’

  • 0

Is it possible to take an array of values, for example:

$index = array('0' => '1', '1' => '4', '2' => '7');

And use this to update the position of another array at position $update['1']['4']['7']?

I thought maybe I could do something like the below (but it seems that I can’t)…

for($build_key=0;$build_key<3; $build_key++){
    $this_key .= "[".$index[$build_key]."]";
}
$update.$this_key = 'new data in';

Update

I’m not sure how many levels the array will have, which is why I’ve tried to use a for loop (i’ve put ‘3’ above in the for loop though maybe i should have used count($index) instead.

  • 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-28T13:16:50+00:00Added an answer on May 28, 2026 at 1:16 pm

    Like this?

    $x = $index[0];
    $y = $index[1];
    $z = $index[2];
    
    $update[$x][$y][$z] = 'new data in';
    

    This will work for any length array:

    $index = array('0' => '1', '1' => '4', '2' => '7');
    $where = &$update;
    
    foreach ($index as $key => $value)
        $where = &$where[$value];      
    
    $where = 'new data in';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to take a DLGTEMPLATE and use it as a CWnd-derived control
This is a two part question. Is it possible to take advantage of xVal
Is it possible to generate comments for closing div tags, lets take this ex.
Is it possible to take a screen capture of a particular area of a
Is it possible in ASP.NET to take a string containing some HTML and make
Is it possible to write a servlet filter to take inspect HTTP response codes?
Possible Duplicate: Backup SQL Schema Only? Anybody tell how to take sql database backup
Is it possible to have a <div> simultaneously (1) not take up all available
I am looking to take a map<char, vector<char> > and generate each possible map<char,
I am trying to consume a wcf rest service via reflection if possible. Take

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.