Re: [PHP] dynamic/multidimensional arrays in classes

2003-03-28 Thread Jason k Larson
The problem here lies with the each function, I believe. I played with this for a minute and that's where I ran into problems with unexpected behaviour. Regardless, I was able to get expected functionality using foreach instead of the while loop. While foreach isn't available in PHP3 it is in

Re: [PHP] dynamic/multidimensional arrays in classes

2003-03-27 Thread Patrick Teague
I'm currently having a problem with another array in a class & I can't figure it out - class myClass { function myClass($arr = array( 'item1'=>array('a','b','c'), 'item2'=>array('a','b','c') ) ) { print_r( $arr ); while( list($key,$val) = each($arr) ) {

Re: [PHP] dynamic/multidimensional arrays in classes

2003-03-12 Thread Patrick Teague
--- From: "James Holden" <[EMAIL PROTECTED]> To: "Patrick Teague" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, March 10, 2003 4:01 AM Subject: Re: [PHP] dynamic/multidimensional arrays in classes > $this->$arr[] > > should be &g

Re: [PHP] dynamic/multidimensional arrays in classes

2003-03-10 Thread James Holden
$this->$arr[] should be $this->arr[] You are using a variable defined within the class - since it is a class variable you can reference it as you would anything else within the class, using '$this->' Patrick Teague wrote: I'm having problems figuring this out. This first way gives me a

RE: [PHP] dynamic/multidimensional arrays in classes

2003-03-09 Thread John W. Holmes
> I'm having problems figuring this out. This first way gives me a 'Fatal > Error: Cannot use [] for reading in class.php on line xx' > > class myClass > { >var $arr = array(); > >function add_something( $value ) >{ > $this->$arr[] = $value; // this is the line causing the