[nycphp-talk] Disappearing data or I've gone mad

CHUN-YIU LAM chun_lam at
Wed Feb 12 23:59:00 EST 2003

can you get $kw? because this foreach does not look right...

foreach($kws as $kw)

Don't know much about this syntax.  But I think this is missing the values 
like this

foreach($kws as $kw => $value)

----Original Message Follows----
From: Jeremy Hise <jhise at>
Reply-To: talk at
To: NYPHP Talk <talk at>
Subject: [nycphp-talk] Disappearing data or I've gone mad
Date: Wed, 12 Feb 2003 12:58:02 -0500
Received: from ([]) by with Microsoft SMTPSVC(5.0.2195.5600); Wed, 12 Feb 
2003 09:58:21 -0800
Received: from ( [])by (8.12.6/8.12.6) with ESMTP id h1CHw27g054007for 
<chun_lam at>; Wed, 12 Feb 2003 12:58:20 -0500 (EST)(envelope-from 
null at
X-Message-Info: dHZMQeBBv44lPE7o4B5bAg==
Message-Id: <200302121758.h1CHw27g054007 at>
X-Paralist-Archived: <>
X-List-Software: Paralist 0.6
List-ID: <>
List-Owner: <mailto:listmaster at>
List-Archive: <>
List-Subscribe: <>
List-Unsubscribe: <>
Organization: New York PHP
X-Mailer: Paramail 0.5
Return-Path: null at
X-OriginalArrivalTime: 12 Feb 2003 17:58:21.0783 (UTC) 


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, 


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

--- Unsubscribe at ---

Add photos to your e-mail with MSN 8. Get 2 months FREE*.

More information about the talk mailing list