Welcome Guest, Not a member yet? Register   Sign In
PHP Array Question
#4

[eluser]CodeIgniterNewbie[/eluser]
usmc:

1. Your first approach declares a new variable, $you_are_killing_me_smalls. I am trying to avoid declaring a new variable. Instead, I want to access the individual elements of a method that returns an array directly.

2. I'm not too sure what your second approach does. It seems that $this->arrayContainer will always contain an empty array. Also, the call $MyObject->arrayContainer[1]; breaks encapsulation.

wiredesignz:

1. Changing the method signature is not an option.


Isn't there a way to access element values directly from a method that returns an array? It's possible to apply other array functions to such a result (e.g. count($MyObject->GetMyArray()), etc.). So, why not a way to access particular elements?


Messages In This Thread
PHP Array Question - by El Forum - 06-16-2008, 08:12 PM
PHP Array Question - by El Forum - 06-16-2008, 08:56 PM
PHP Array Question - by El Forum - 06-16-2008, 09:38 PM
PHP Array Question - by El Forum - 06-17-2008, 06:46 PM
PHP Array Question - by El Forum - 06-17-2008, 07:17 PM
PHP Array Question - by El Forum - 06-17-2008, 09:25 PM
PHP Array Question - by El Forum - 06-17-2008, 09:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB