Disappearing data or I've gone mad

Jeremy Hise jhise at
Wed Feb 12 13:00:33 EST 2003


I have a very strange situation that may be difficult for me to convey...but either PHP is having problems, or I'm just a jackass.

Here is the weirdo code with some of my attempt to debug. $this->data contains an array of "keys" that need to be replaced with values. This is kind of a ghetto template parser. Everything is fine until I get inside the for loop (which used to be a foreach...but I'm trying everything. Inside that loop, I cannot get $this->data[$key] to print out anything!

I'm just basically looking for someone to see if I'm overlooking something.

Thanks a billion!


     function parse() {
        // Get an array of items such as 'first_name', 'last_name', etc
        $kws = $this->get_tags();

        // If we do have an array of keywords
        if(is_array($kws)) {
            // For each keyword
            foreach($kws as $kw) {
                // Get the value from this object's data hasa
                $value = $this->data["$kw"];  // <-- this has no data in it inside this loop
                // Replace the smac tagged keyword with the value
                $this->body = ereg_replace("<smac>".$kw."</smac>", $value, $this->body);


 | jhise at |
 | developer            |
 | nextSource, Inc.     |
 | x334                 |

More information about the talk mailing list