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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:08:01+00:00 2026-06-17T06:08:01+00:00

Ive got some generated arrays, and their variable names stored in another array like

  • 0

Ive got some generated arrays, and their variable names stored in another array like the following

$array1 = 4x119 array;
$array2 = 4x119 array;
etc ..
$var1= [
"array1",
"array2",
etc...
];

and trying to loop though them like this

foreach ($var1 as $loopitem){
var_dump($$loopitem[3]);
}

How can i make this less ambiguous ?

Currenly im fairly sure its looking for a variable called the contents of $loopitem[3] instead of looking at $arr1[3] as without the [3] the var dump returns correct

Without the [3]

array(4) {
  [0]=>
  array(119) { 

rest of output

With [3]

NULL

Any suggestions ?

  • 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-17T06:08:02+00:00Added an answer on June 17, 2026 at 6:08 am

    You can use ${$loopitem}[3] to make it readable and unambiguous. Actually I’d always use that syntax for variable variables since $$foo is easy to misread as $foo.

    However, it would be even better not to use them at all and use an array instead!

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

Sidebar

Related Questions

I've got some dynamically-generated boolean logic expressions, like: (A or B) and (C or
I've got the following HTML, generated by TYPO3 (simplified): <div class=image> <img src=some-image.jpg/> </div>
I've got some SQL that I'd like to format correctly for a mailout (generated
How can I manually set a position with some code? Ok Ive got some
Ive got a model caleld SpacialBody, and I need to seed some records so
I've got a DLL that contains some XSD-generated classes. Unfortunately, XSD.exe makes those classes
I've got an ILookup generated by some complicated expression. Let's say it's a lookup
I've got a C++ Xcode 3 project generated from CMake scripts. It uses some
So I've got something like: void createSinewave( short * array, int duration, int startOffset,
Okay, I have some procedurally generated terrain (based loosely on http://www.swiftless.com/terraintuts.html ) Ive got

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.