-2

If I have the following variable in a class

protected $address 

and in a function test, I do

$testAddress = $this->address; 

and then

$testAddress['state'] = 'KO'; 

Does that change the state for $this->address ... meaning any function that uses $this->address will have the modified state?

3
  • 1
    No it does not. $this->address will remain the same unless you pass by reference Commented Dec 11, 2013 at 2:26
  • 2
    Would have been pretty easy to write that code and see what happens. Commented Dec 11, 2013 at 2:29
  • The fact that you need it means that you have fundamental issues with design Commented Dec 11, 2013 at 2:31

1 Answer 1

0

It will only change the state or value of $testAddress but not $this->address.

As per the given code, nothing yet has been set as value on $address

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.