Re: [PHP] Re: How to Set Object Array Value || In $this->$name[] Format...

2006-10-05 Thread John Wells
On 10/5/06, sit1way <[EMAIL PROTECTED]> wrote: Hey all. I've got a simple object method that sets object vars based on a passed array: ** function set($arr) { foreach($arr as $name => $value) { if(is_array($this->name)) {

Re: [PHP] Re: How to Set Object Array Value || In $this->$name[] Format...

2006-10-05 Thread Richard Lynch
It may be easier to do: $array = $this->$name; $array[] = $value; Some combination of {} and $this->{$name}[] = $value may also work... As it stands now, $name[] looks like you are trying to get an index on $name FIRST, and then use $this-> on that SECOND... I think. On Thu, October 5, 2006 11

[PHP] Re: How to Set Object Array Value || In $this->$name[] Format...

2006-10-05 Thread sit1way
Hey all. I've got a simple object method that sets object vars based on a passed array: ** function set($arr) { foreach($arr as $name => $value) { if(is_array($this->name)) { $this->$name[] = $value; }