Re: Help: arrays in a class

From: Date: Wed, 28 Jan 2004 16:18:15 +0000
Subject: Re: Help: arrays in a class
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-176066@lists.php.net to get a copy of this message
jazzman@exdomain.org wrote: <snip>
Here's the problem. In ParseFile I call the function: array_push($this->$includedFiles, $ifName);
Here you have it ending in an 's'....
where $ifName is the name of an include file I found in the code. However, I get an error stating the first argument must be an array. So I tried making the constructor look like this: function clsfTreeNode( $fileName ) { $this->$fName = $fileName; $this->$fData = file_get_contents($this->$fName); $this->$includedFile = array();
Here you have it without an 's'....
$this->ParseFile(); print count($this->$includedFiles); } and that seems to work ok EXCEPT that $fData also becomes an array and it's contents erased! I've tried moving things around, etc but no matter where i make $includedFile an array $fData gets screwed up. If I don't explicitly make $includedFile an array then nothing works anyway. I'm going out of my mind trying to get this to work, and it shouldn't be so hard. I'm using php 4.3.4 on a WinXP machine. Any thoughts?
Don't know if the 's' is the problem, but it's a start. Also, you may want to declare you $includeFile(s) as an array at the start of your class. I'm just guessing here, but declaring it as such ($this->$includeFile = array()) may be emptying $this too. -- By-Tor.com It's all about the Rush http://www.by-tor.com

« previous php.general (#176066) next »