NYCPHP Meetup

NYPHP.org

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

Daniel Kushner nyphp at websapp.com
Thu Feb 13 09:29:30 EST 2003


foreach($kws as $kw): $kw will get the values of the array
foreach($kws as $kw => $value): $kw will get the index values of the array and $value the actual values (as $kw did in
the first example).

--Daniel


> -----Original Message-----
> From: Jeremy Hise [mailto:jhise at nextsource.com]
> Sent: Thursday, February 13, 2003 9:29 AM
> To: NYPHP Talk
> Subject: Re: [nycphp-talk] Disappearing data or I've gone mad
>
>
> I've never had problems with this syntax.
>
>
>
> On Wed, 12 Feb 2003 23:59:03 -0500
> "CHUN-YIU LAM" <chun_lam at hotmail.com> wrote:
>
> > 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 nextsource.com>
> > Reply-To: talk at nyphp.org
> > To: NYPHP Talk <talk at nyphp.org>
> > Subject: [nycphp-talk] Disappearing data or I've gone mad
> > Date: Wed, 12 Feb 2003 12:58:02 -0500
> > Received: from parsec.nyphp.org ([66.250.131.26]) by
> > mc10-f19.bay6.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Wed, 12 Feb
> > 2003 09:58:21 -0800
> > Received: from nyphp.org (parsec.nyphp.org [66.250.131.26])by
> > parsec.nyphp.org (8.12.6/8.12.6) with ESMTP id h1CHw27g054007for
> > <chun_lam at hotmail.com>; Wed, 12 Feb 2003 12:58:20 -0500 (EST)(envelope-from
> > null at nyphp.org)
> > X-Message-Info: dHZMQeBBv44lPE7o4B5bAg==
> > Message-Id: <200302121758.h1CHw27g054007 at parsec.nyphp.org>
> > X-Paralist-Archived: <http://nyphp.org/list/paralist_archive.php?L_mid=2955>
> > X-List-Software: Paralist 0.6
> > List-ID: <nyphptalk.nyphp.org>
> > List-Owner: <mailto:listmaster at nyphp.org>
> > List-Archive: <http://nyphp.org/list/paralist_archive.php?L_lid=1>
> > List-Subscribe: <http://nyphp.org/list/>
> > List-Unsubscribe: <http://nyphp.org/list/>
> > Organization: New York PHP
> > X-Mailer: Paramail 0.5
> > Return-Path: null at nyphp.org
> > X-OriginalArrivalTime: 12 Feb 2003 17:58:21.0783 (UTC)
> > FILETIME=[54C95670:01C2D2C0]
> >
> > Hi:
> >
> > 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!
> >
> > hise
> >
> >       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);
> >              }
> >          }
> >          return($this->body);
> >      }
> >
> >
> >
> > --
> >
> > -+----------------------+
> >   | jhise at nextsource.com |
> >   | developer            |
> >   | nextSource, Inc.     |
> >   | x334                 |
> >   +----------------------+
> >
> >
> >
> >
> >
> > _________________________________________________________________
> > Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> > http://join.msn.com/?page=features/featuredemail
> >
> >
> >
> >
> >
>
>
> --
>
> -+----------------------+
>  | jhise at nextsource.com |
>  | developer            |
>  | nextSource, Inc.     |
>  | x334                 |
>  +----------------------+
>
>
> --- Unsubscribe at http://nyphp.org/list/ ---
>




More information about the talk mailing list