[PHP] foreach loop to set variables

2008-04-25 Thread jamest
I am passing an array to a class which I want to take the array data and create some variables from the array's keys and values. So I want to create (in this case 21) new variables that I want to create in the foreach but with no success. foreach ($formdata as $key = $value) { echo $key

Re: [PHP] foreach loop to set variables

2008-04-25 Thread Stut
On 25 Apr 2008, at 14:12, jamest wrote: I am passing an array to a class which I want to take the array data and create some variables from the array's keys and values. So I want to create (in this case 21) new variables that I want to create in the foreach but with no success. foreach

Re: [PHP] foreach loop to set variables

2008-04-25 Thread Jason Norwood-Young
On Fri, 2008-04-25 at 06:12 -0700, jamest wrote: I am passing an array to a class which I want to take the array data and create some variables from the array's keys and values. So I want to create (in this case 21) new variables that I want to create in the foreach but with no success.

Re: [PHP] foreach loop to set variables

2008-04-25 Thread Casey
On Apr 25, 2008, at 6:12 AM, jamest [EMAIL PROTECTED] wrote: I am passing an array to a class which I want to take the array data and create some variables from the array's keys and values. So I want to create (in this case 21) new variables that I want to create in the foreach but with

Re: [PHP] foreach loop to set variables

2008-04-25 Thread jamest
Thats perfect. I didn't even know about this. Stut wrote: $$key = $value; They're called variable variables - search the manual for that term for more info. -Stut -- http://stut.net/ -- View this message in context:

Re: [PHP] foreach loop to set variables

2008-04-25 Thread Jim Lucas
jamest wrote: I am passing an array to a class which I want to take the array data and create some variables from the array's keys and values. So I want to create (in this case 21) new variables that I want to create in the foreach but with no success. foreach ($formdata as $key = $value) {

RE: [PHP] foreach loop changed after 4.3 - 4.4 upgrade

2005-08-24 Thread Larry Brown
] foreach loop changed after 4.3 - 4.4 upgrade I had a foreach loop working on an array as such: $multiarray = array(array('person','person'),array('another','another')) the array was put through foreach($multiarray as $subArray){ do something with array } on each

RE: [PHP] foreach loop changed after 4.3 - 4.4 upgrade

2005-08-23 Thread Ford, Mike
-Original Message- From: Larry Brown To: php Sent: 23/08/05 02:28 Subject: [PHP] foreach loop changed after 4.3 - 4.4 upgrade I had a foreach loop working on an array as such: $multiarray = array(array('person','person'),array('another','another')) the array was put through foreach

Re: [PHP] foreach loop changed after 4.3 - 4.4 upgrade

2005-08-23 Thread Edward Vermillion
Larry Brown wrote: I found that the only way to get the function to behave is to add the key... foreach($multiarray as $key=$subArray) Now it displays as it previously did where $subArray is concerned. Is there something I'm missing here? Was I the only person not using keys? [snip]

Re: [PHP] foreach loop changed after 4.3 - 4.4 upgrade

2005-08-23 Thread Evert | Rooftop
I switched from 4.3 to 4.4 on a server with a huge web application using both foreach loops with and without the keys.. No problem whatsoever.. Evert Larry Brown wrote: I found that the only way to get the function to behave is to add the key... foreach($multiarray as $key=$subArray) Now

Re: [PHP] foreach loop changed after 4.3 - 4.4 upgrade

2005-08-23 Thread Pinter Tibor (tibyke)
turck-mmcache? t Edward Vermillion wrote: Larry Brown wrote: I found that the only way to get the function to behave is to add the key... foreach($multiarray as $key=$subArray) Now it displays as it previously did where $subArray is concerned. Is there something I'm missing here? Was I

RE: [PHP] foreach loop changed after 4.3 - 4.4 upgrade

2005-08-23 Thread Larry Brown
On Tue, 2005-08-23 at 05:30, Ford, Mike wrote: -Original Message- From: Larry Brown To: php Sent: 23/08/05 02:28 Subject: [PHP] foreach loop changed after 4.3 - 4.4 upgrade I had a foreach loop working on an array as such: $multiarray = array(array('person','person'),array

RE: [PHP] foreach loop changed after 4.3 - 4.4 upgrade

2005-08-23 Thread Larry Brown
: 23/08/05 02:28 Subject: [PHP] foreach loop changed after 4.3 - 4.4 upgrade I had a foreach loop working on an array as such: $multiarray = array(array('person','person'),array('another','another')) the array was put through foreach($multiarray as $subArray){ do something with array

[PHP] foreach loop changed after 4.3 - 4.4 upgrade

2005-08-22 Thread Larry Brown
I had a foreach loop working on an array as such: $multiarray = array(array('person','person'),array('another','another')) the array was put through foreach($multiarray as $subArray){ do something with array } on each loop I would see $subArray= array([0] = 'person',[1] = 'person') and then

Re: [PHP] foreach loop changed after 4.3 - 4.4 upgrade

2005-08-22 Thread Larry Brown
I found that the only way to get the function to behave is to add the key... foreach($multiarray as $key=$subArray) Now it displays as it previously did where $subArray is concerned. Is there something I'm missing here? Was I the only person not using keys? On Mon, 2005-08-22 at 21:28, Larry

[PHP] Foreach loop with empty values

2003-06-13 Thread CDitty
I have a foreach loop in a while loop that retrieves information from my database. The foreach loop works fine if there is data in the database for that loop. But if nothing is found in the database, I get a Invalid argument supplied error. Can anyone suggest a fix for this? The foreach

Re: [PHP] Foreach loop with empty values

2003-06-13 Thread CDitty
Got it fixed. Never mind. Thanks At 10:49 PM 6/13/2003, CDitty wrote: I have a foreach loop in a while loop that retrieves information from my database. The foreach loop works fine if there is data in the database for that loop. But if nothing is found in the database, I get a Invalid

[PHP] Foreach loop syntax

2001-08-14 Thread Keith Devens
Ok, I asked a similar question more than a year ago, so I apologize for being a little redundant :) Why was PHP's foreach loop syntax chosen to be foreach($dogs as $dog){} instead of something more common (Python, Javascript, can't think what else right now) and, to me, more intuitive, like

[PHP] foreach loop

2001-07-07 Thread John Meyer
When I go through a foreach loop, are the values of the individual items in the array changed? For instance: $variables = array($author_firstname, $author_lastname, $author_dob, $author_dod, $author_bio); foreach($variables as $value) { $value = strip_tags($value); $value =

RE: [PHP] foreach loop

2001-07-07 Thread PHPBeginner.com
08, 2001 2:32 AM To: [EMAIL PROTECTED] Subject: [PHP] foreach loop When I go through a foreach loop, are the values of the individual items in the array changed? For instance: $variables = array($author_firstname, $author_lastname, $author_dob, $author_dod, $author_bio); foreach($variables

RE: [PHP] foreach loop

2001-07-07 Thread PHPBeginner.com
If we didn't have Microsoft, we'd have to blame ourselves for all of our programs crashing I really don't think so :-) -maxim maletsky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To

Re: [PHP] foreach loop

2001-07-07 Thread Steve Edberg
At 10:31 AM -0700 7/7/01, John Meyer wrote: When I go through a foreach loop, are the values of the individual items in the array changed? For instance: $variables = array($author_firstname, $author_lastname, $author_dob, $author_dod, $author_bio); foreach($variables as $value) {

RE: [PHP] foreach loop

2001-07-07 Thread John Monfort
If we didn't have Microsoft, we'd have to blame ourselves for all of our programs crashing If we didn't have microsoft, 'Crashing Programs' wouldn't be part of our daily vocabulary :) __John Monfort_ _+---+_ P E P I E D E S I

Re: [PHP] foreach loop

2001-07-07 Thread Chris Anderson
Good call - Original Message - From: John Monfort [EMAIL PROTECTED] To: PHPBeginner.com [EMAIL PROTECTED] Cc: John Meyer [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, July 07, 2001 6:27 PM Subject: RE: [PHP] foreach loop If we didn't have Microsoft, we'd have to blame