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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:52:08+00:00 2026-06-08T01:52:08+00:00

I have a multidimensional array of integers that only works inside of the function,

  • 0

I have a multidimensional array of integers that only works inside of the function, but produces random numbers when I try to pass it to another function.

PS> $array
1
2
3
4
PS> $array[0]
1
2
PS> $array[0][1]
2

The array was originally formed with:

$array = @(($data1),($data))

and appended on $data for any array after that: ($data is cleared each iteration)

$array += ,($data)

Which seems to be fine, considering before I tried to create functions everything was working.
I then try to pass the array into a another function

theFunc ($array)
    Function theFunc {
    param ($theData)
    #process data
    }

I’m getting the correct ammount of arrays, but the numbers inside them do not match the multidimensional array that I passed in one bit.
Any help is appreciated, thank you.

  • 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-08T01:52:09+00:00Added an answer on June 8, 2026 at 1:52 am

    I tried the following example and everything seems to be fine:

    $data1 = @(1, 2, 3, 4)
    $data2 = @(5, 6, 7, 8)
    @($data1, $data2)
    $array[0]
    1
    2
    3
    4
    $array[1]
    5
    6
    7
    8
    function myFunc { param($arr) $arr; $arr[0]; $arr[1]; }
    myFunc($array)
    1
    2
    3
    4
    5
    6
    7
    8
    1
    2
    3
    4
    5
    6
    7
    8
    

    Please provide output you get.

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

Sidebar

Related Questions

I have a multidimensional array. I need a function that checks if a specified
I have an multidimensional array that looks like this: Array ( [0] => Array
Explanation I have a multidimensional array that is iterated over to created a categorized
I have a multidimensional array that looks something like this: ourThing = array( 'id'
I have a multidimensional array that look like this: Array [1] => Array (
I have a multidimensional array, and I need to sort that array by a
I have a multidimensional array that is behaving unexpectedly and I would like to
I have a multidimensional array that stores people. Array ( id93294 => array (
I have a multidimensional array that looks like this: Array ( [0] => Array
I have a multidimensional array in PHP, something that looks like: array(array(Category => Video,

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.