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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:15:17+00:00 2026-05-25T14:15:17+00:00

Looking at referencing in PHP is pretty much confusing me, can anyone explain to

  • 0

Looking at referencing in PHP is pretty much confusing me, can anyone explain to me how this would work:

private $TestArray1 = Array()
private $TestArray2 = Array()

private function test1(){
$this->test2($this->TestArray1);
$this->test2($this->TestArray2);
}

private function test2($Array){
$this->test3($Array);
}

private function test3($Array){
$Array[0] = 1;
}

Where would I be putting the “&” in this, if I wanted to have the private variables TestArray1 and TestArray2 be edited, after it is set in function test3?

  • 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-25T14:15:18+00:00Added an answer on May 25, 2026 at 2:15 pm
    private $TestArray1 = Array()
    private $TestArray2 = Array()
    
    private function test1(){
    $this->test2($this->TestArray1);
    $this->test2($this->TestArray2);
    }
    
    private function test2(&$Array){
    $this->test3($Array);
    }
    
    private function test3(&$Array){
    $Array[0] = 1;
    }
    

    So you need to specify & in the function declaration, and pass parameter as-is.

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

Sidebar

Related Questions

See http://www.sitepen.com/blog/2008/06/17/json-referencing-in-dojo/ for how it's used in dojo. I'm looking for libraries that can
In PHP one can create a reference variable, so that two named variables can
In a PHP MVC framework, how can I cleanly and elegantly exit from the
Stumped on this one. I have a many to many self referencing relationship(FluentNH) mapped
This seems like a pretty softball question, but I always have a hard time
Greetings and thank you for looking at my question, I hope you can provide
Im having trouble unsetting a key within an array using prototype (though this is
Referencing the sample below, is there a way to pass the work done by
I've been looking around for an answer. I've been cross-referencing my code with others.
I know this is a probable open ended question, and I have tried looking

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.