Hi all,

I'm having some trouble here and I hope you can help. I'm writing a class 
for PHP to help track includes in a c++ source file. My class has 3 
member variables:

        a filename
        file contents
        array of files that file includes

The class definition looks like this

class clsfTreeNode
{

        //member variables
        var $fName;
        var $fData;
        var $includedFiles;
        
        //constructor
        function clsfTreeNode( $fileName )
        {
                $this->$fName = $fileName;
                $this->$fData = file_get_contents($this->$fName);
                
                $this->ParseFile();
                
                print count($this->$includedFiles);
                
        }

        function ParseFile();
        {
                ...Long Drawn Out Code Omitted...
        }
};

Here's the problem. In ParseFile I call the function:

                array_push($this->$includedFiles, $ifName);

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();         
                $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?

THanks
Marc

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to