RE: [PHP] arrays in a class
I'm just glad it's working! It's hard to debug when you can't see what's in the arrays :-) The {} way is definitely not as nice looking - at least this way when some other poor soul works with my code they have a chance at understanding what was going on! Thanks again! -Natalie -Original Message- From: Alexander Skwar [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 23, 2002 4:45 PM To: Leotta, Natalie (NCI/IMS) Cc: [EMAIL PROTECTED] Subject: Re: [PHP] arrays in a class »Leotta, Natalie (NCI/IMS)« sagte am 2002-04-23 um 16:37:37 -0400 : > Wow. Now I'm feeling dumb... It does work with my non-array vars > though - Yes, it doesn't suprise me that it works with non arrays. The parser doesn't seem to be clever enough to catch that you want to pass [0] as the array index to the class var apcs of $this. Instead of doing it the way I just suggested, you could have also done "{$this->apcs[0]}", I think. I seem to remember that this also should be possible - but IMO that's even a lot more broken than my way and I've never used it. > Thanks!! np Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.iso-top.de |Jabber: [EMAIL PROTECTED] iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 14 hours 58 minutes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] arrays in a class
»Leotta, Natalie (NCI/IMS)« sagte am 2002-04-23 um 16:37:37 -0400 : > Wow. Now I'm feeling dumb... It does work with my non-array vars though - Yes, it doesn't suprise me that it works with non arrays. The parser doesn't seem to be clever enough to catch that you want to pass [0] as the array index to the class var apcs of $this. Instead of doing it the way I just suggested, you could have also done "{$this->apcs[0]}", I think. I seem to remember that this also should be possible - but IMO that's even a lot more broken than my way and I've never used it. > Thanks!! np Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.iso-top.de |Jabber: [EMAIL PROTECTED] iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 14 hours 58 minutes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] arrays in a class
Wow. Now I'm feeling dumb... It does work with my non-array vars though - I guess laziness caught me. Thanks!! -Original Message- From: Alexander Skwar [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 23, 2002 4:36 PM To: Leotta, Natalie (NCI/IMS) Cc: [EMAIL PROTECTED] Subject: Re: [PHP] arrays in a class »Leotta, Natalie (NCI/IMS)« sagte am 2002-04-23 um 16:27:46 -0400 : > ImageString($this->im,1,65,5,"apcs[0] = > $this->apcs[0]",$this->black); Hm, try to use proper syntax here, ie: ImageString($this->im,1,65,5,"apcs[0] = " . $this->apcs[0],$this->black); Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.iso-top.de |Jabber: [EMAIL PROTECTED] iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 14 hours 51 minutes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] arrays in a class
»Leotta, Natalie (NCI/IMS)« sagte am 2002-04-23 um 16:27:46 -0400 : > ImageString($this->im,1,65,5,"apcs[0] = $this->apcs[0]",$this->black); Hm, try to use proper syntax here, ie: ImageString($this->im,1,65,5,"apcs[0] = " . $this->apcs[0],$this->black); Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.iso-top.de |Jabber: [EMAIL PROTECTED] iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 14 hours 51 minutes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] arrays in a class
Do I have to do anything different to access an array in a class? I have var $apcs = array(); at the top of my class I set it using $line1->adj_array[$pos] = (integer) $value; in the read-in part of the app that uses the class ($line1 is the object, $pos is just a number) Later on in the class I try to do this: ImageString($this->im,1,65,5,"apcs[0] = $this->apcs[0]",$this->black); and it prints out apcs[0] = Array[0] I've never had this happen before - I've always accessed members of an array by using the square brackets? I also tried [0][0] but that didn't work either. Can anyone see what I might be doing incorrectly? Thanks! -Natalie Natalie S. Leotta Information Management Services, Inc. (301) 680-9770 [EMAIL PROTECTED]