Re: [PHP] array question

2010-12-20 Thread Ravi Gehlot
Jim Lucas has it. You can use the preg_match function to find it. I would use regexp for that reason. regexp is good for making sure things are typed the way they need to (mostly used for). Ravi. On Sat, Dec 18, 2010 at 5:17 PM, Jim Lucas li...@cmsws.com wrote: On 12/17/2010 12:52 PM, Sorin

Re: [PHP] array question

2010-12-18 Thread Jim Lucas
On 12/17/2010 12:52 PM, Sorin Buturugeanu wrote: Hello all! I have a question regarding arrays and the way I can use a value. Let's say I have this string: $s = 'banana,apple,mellon,grape,nut,orange' I want to explode it, and get the third value. For this I would normally do: $a =

RE: [PHP] array question

2010-12-17 Thread Jay Blanchard
[snip] I have a question regarding arrays and the way I can use a value. Let's say I have this string: $s = 'banana,apple,mellon,grape,nut,orange' I want to explode it, and get the third value. For this I would normally do: $a = explode(',', $s); echo $s[2]; That's all fine, but is there a

Re: [PHP] array question

2010-12-17 Thread Daniel Brown
On Fri, Dec 17, 2010 at 15:52, Sorin Buturugeanu m...@soin.ro wrote: Hello all! I have a question regarding arrays and the way I can use a value. Let's say I have this string: $s = 'banana,apple,mellon,grape,nut,orange' I want to explode it, and get the third value. For this I would

Re: [PHP] array question

2010-12-17 Thread Sorin Buturugeanu
Tanks for all of your responses! I guess a function is the way to go. I just have to see if the situation comes up enough times to justify the function approach. @Dan: I really enjoyed your disclaimer :D -- Sorin Buturugeanu www.soin.ro http://www.facebook.com/buturugeanu

Re: [PHP] Array question

2010-09-26 Thread a...@ashleysheridan.co.uk
I'd also like to add to that: $array = array(); $array[] = 'text'; $array[2] = 123; $array[] = 'hello'; Would output: $array( 0 = 'text', 2 = 123, 3 = 'hello', ); Note the missing index 1, as php makes a numerical index that is one greater than the highest already in use. As the index 2 was

Re: [PHP] Array question

2010-09-26 Thread tedd
At 3:31 PM -0500 9/25/10, MikeB wrote: -snip- My question, in the loop, why does tha author use: $results[] = mysql_fetch_array($result); instead of (as I would expect): $results[$j] = mysql_fetch_array($result);? What PHP magic is at work here? Mike: That's just a shorthand way to

Re: [PHP] Array question

2010-09-25 Thread chris h
Mike, $results[] will automatically push a value unto the end of an array. So doing this... -- $magic = array(); $magic[] = 'a'; $magic[] = 'b'; $magic[] = 'c'; - is exactly this same as doing this... -- $normal = array(); $normal[0] = 'a'; $normal[1] = 'b'; $normal[2] = 'c'; -

Re: [PHP] Array Question

2007-07-17 Thread kvigor
Thanks for all the input. You've all been pretty informative. Sorry of delayed response to help but was busy. You all are appreciated. Stut [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Richard Lynch wrote: On Wed, July 11, 2007 4:16 pm, Robert Cummings wrote: But I'd have to

Re: [PHP] Array Question

2007-07-14 Thread Robert Cummings
On Sat, 2007-07-14 at 00:55 -0500, Richard Lynch wrote: On Fri, July 13, 2007 2:15 am, Richard Lynch wrote: On Thu, July 12, 2007 8:29 am, Robert Cummings wrote: Hmmm, I thought using an explicit cast was very self explanatory -- especially when the name of the cast is array. Maybe I'm

Re: [PHP] Array Question

2007-07-13 Thread Richard Lynch
On Thu, July 12, 2007 8:29 am, Robert Cummings wrote: Hmmm, I thought using an explicit cast was very self explanatory -- especially when the name of the cast is array. Maybe I'm alone in that thought. I mean if you convert a scalar to an array what do you expect to get? An array with the

Re: [PHP] Array Question

2007-07-13 Thread Robert Cummings
On Fri, 2007-07-13 at 02:15 -0500, Richard Lynch wrote: On Thu, July 12, 2007 8:29 am, Robert Cummings wrote: Hmmm, I thought using an explicit cast was very self explanatory -- especially when the name of the cast is array. Maybe I'm alone in that thought. I mean if you convert a scalar

Re: [PHP] Array Question

2007-07-13 Thread Richard Lynch
On Fri, July 13, 2007 2:15 am, Richard Lynch wrote: On Thu, July 12, 2007 8:29 am, Robert Cummings wrote: Hmmm, I thought using an explicit cast was very self explanatory -- especially when the name of the cast is array. Maybe I'm alone in that thought. I mean if you convert a scalar to an

Re: [PHP] Array Question

2007-07-12 Thread Stut
Richard Lynch wrote: On Wed, July 11, 2007 4:16 pm, Robert Cummings wrote: But I'd have to say that the intent is not all that clear, really, and I'd be leery of this feature, personally. I wouldn't be leery at all. It's been around for a very long time and it's documented:

Re: [PHP] Array Question

2007-07-12 Thread Robert Cummings
On Thu, 2007-07-12 at 09:58 +0100, Stut wrote: Richard Lynch wrote: On Wed, July 11, 2007 4:16 pm, Robert Cummings wrote: But I'd have to say that the intent is not all that clear, really, and I'd be leery of this feature, personally. I wouldn't be leery at all. It's been around for a

Re: [PHP] Array Question

2007-07-11 Thread Robin Vickery
On 11/07/07, kvigor [EMAIL PROTECTED] wrote: Is there a php function similar to in_array that can detect if a partial value is in an array value or not: e.g. $var1 = big horse;$var2 = small yellow;$var3 = red hydrant; $theArray = array(big blue horse, small yellow bird, giant red

Re: [PHP] Array Question

2007-07-11 Thread kvigor
Thanks, I've seen the light by your code. Robin Vickery [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 11/07/07, kvigor [EMAIL PROTECTED] wrote: Is there a php function similar to in_array that can detect if a partial value is in an array value or not: e.g. $var1 = big

Re: [PHP] Array Question

2007-07-11 Thread Robert Cummings
On Wed, 2007-07-11 at 09:46 +0100, Robin Vickery wrote: On 11/07/07, kvigor [EMAIL PROTECTED] wrote: Is there a php function similar to in_array that can detect if a partial value is in an array value or not: e.g. $var1 = big horse;$var2 = small yellow;$var3 = red hydrant;

Re: [PHP] Array Question

2007-07-11 Thread Stut
Robert Cummings wrote: On Wed, 2007-07-11 at 09:46 +0100, Robin Vickery wrote: On 11/07/07, kvigor [EMAIL PROTECTED] wrote: Is there a php function similar to in_array that can detect if a partial value is in an array value or not: e.g. $var1 = big horse;$var2 = small yellow;$var3

Re: [PHP] Array Question

2007-07-11 Thread Robert Cummings
On Wed, 2007-07-11 at 15:52 +0100, Stut wrote: Robert Cummings wrote: On Wed, 2007-07-11 at 09:46 +0100, Robin Vickery wrote: On 11/07/07, kvigor [EMAIL PROTECTED] wrote: Is there a php function similar to in_array that can detect if a partial value is in an array value or not: e.g.

Re: [PHP] Array Question

2007-07-11 Thread Stut
Robert Cummings wrote: On Wed, 2007-07-11 at 15:52 +0100, Stut wrote: Robert Cummings wrote: On Wed, 2007-07-11 at 09:46 +0100, Robin Vickery wrote: On 11/07/07, kvigor [EMAIL PROTECTED] wrote: Is there a php function similar to in_array that can detect if a partial value is in an array

Re: [PHP] Array Question

2007-07-11 Thread Robert Cummings
On Wed, 2007-07-11 at 16:07 +0100, Stut wrote: Robert Cummings wrote: On Wed, 2007-07-11 at 15:52 +0100, Stut wrote: Robert Cummings wrote: On Wed, 2007-07-11 at 09:46 +0100, Robin Vickery wrote: On 11/07/07, kvigor [EMAIL PROTECTED] wrote: Is there a php function similar to in_array

Re: [PHP] Array Question

2007-07-11 Thread Robin Vickery
On 11/07/07, Robert Cummings [EMAIL PROTECTED] wrote: On Wed, 2007-07-11 at 09:46 +0100, Robin Vickery wrote: On 11/07/07, kvigor [EMAIL PROTECTED] wrote: Is there a php function similar to in_array that can detect if a partial value is in an array value or not: e.g. $var1 = big

Re: [PHP] Array Question

2007-07-11 Thread Richard Lynch
On Wed, July 11, 2007 9:52 am, Stut wrote: $needle = (array)$needle; Conversion to array creates an array with one element... the value converted. Without raising a notice? Sure looks like it: php -d error_reporting=2047 -r '$foo = (array) foo; var_dump($foo);' array(1) { [0]=

Re: [PHP] Array Question

2007-07-11 Thread Robert Cummings
On Wed, 2007-07-11 at 16:11 -0500, Richard Lynch wrote: On Wed, July 11, 2007 9:52 am, Stut wrote: $needle = (array)$needle; Conversion to array creates an array with one element... the value converted. Without raising a notice? Sure looks like it: php -d error_reporting=2047

Re: [PHP] Array Question

2007-07-11 Thread Richard Lynch
On Wed, July 11, 2007 4:16 pm, Robert Cummings wrote: But I'd have to say that the intent is not all that clear, really, and I'd be leery of this feature, personally. I wouldn't be leery at all. It's been around for a very long time and it's documented:

Re: [PHP] Array Question

2007-07-11 Thread Robert Cummings
On Wed, 2007-07-11 at 16:40 -0500, Richard Lynch wrote: On Wed, July 11, 2007 4:16 pm, Robert Cummings wrote: But I'd have to say that the intent is not all that clear, really, and I'd be leery of this feature, personally. I wouldn't be leery at all. It's been around for a very long

Re: [PHP] Array Question

2007-03-25 Thread Stut
[EMAIL PROTECTED] wrote: $count=count($data-legs-leg); $k=0; while($k $count) {

RE: [PHP] Array Question

2007-03-24 Thread Jake McHenry
$legrow[$data-legs-leg[$k]['legId']] ?? See if that works... Jake -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Saturday, March 24, 2007 11:27 PM To: php-general@lists.php.net Subject: [PHP] Array Question Hi All I am having a bit of trouble

RE: [PHP] Array Question

2007-03-24 Thread Jake McHenry
What if you put $temp = $data-legs-leg[$k]['legId']; And then put that into $legrow[$temp]; Do you have anything in $temp? Jake -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Saturday, March 24, 2007 11:27 PM To: php-general@lists.php.net Subject:

RE: [PHP] Array Question

2007-03-24 Thread rluckhurst
Hi Jake Thanks for the answer. That is what I had in my example that did not work. I had tried that and then wondered how I might access that key. I have tried $legrow[number]; where number is a value I know to be one of the legId's. Is this correct? Regards Richard

RE: [PHP] Array Question

2007-03-24 Thread rluckhurst
Hi Jake I tried that and got the same result. Regards Richard What if you put $temp = $data-legs-leg[$k]['legId']; And then put that into $legrow[$temp]; Do you have anything in $temp? Jake -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Saturday,

RE: [PHP] Array Question

2007-03-24 Thread Jake McHenry
What is the result your getting? Jake -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Saturday, March 24, 2007 11:57 PM To: Jake McHenry Cc: php-general@lists.php.net Subject: RE: [PHP] Array Question Hi Jake I tried that and got the same result

RE: [PHP] Array Question

2007-03-24 Thread rluckhurst
Hi Jake I am getting nothing at all. Regards Richard What is the result your getting? Jake -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Saturday, March 24, 2007 11:57 PM To: Jake McHenry Cc: php-general@lists.php.net Subject: RE: [PHP] Array

RE: [PHP] Array Question

2007-03-24 Thread Jake McHenry
:09 AM To: Jake McHenry Cc: php-general@lists.php.net Subject: RE: [PHP] Array Question Hi Jake I am getting nothing at all. Regards Richard What is the result your getting? Jake -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent

RE: [PHP] Array question

2007-02-27 Thread Ford, Mike
On 27 February 2007 04:23, Gerry D wrote: I have a question on how to retrieve the value that corresponds to a key in an array. $fruit = array('a' = 'apple', 'b' = 'banana', 'c' = 'cranberry'); $key = array_search($c, $fruit); if ( $key === FALSE )

Re: [PHP] Array question

2007-02-27 Thread Gerry D
Mike, See entire function under topic Array question - maybe UTF?... I am trying to change accented characters to their equivalent without accents. And yes, the arrays look fine after var_dump()... Gerry On 2/27/07, Ford, Mike [EMAIL PROTECTED] wrote: On 27 February 2007 04:23, Gerry D

[PHP] Re: php array question

2004-11-01 Thread Ben Ramsey
Victor C. wrote: $OrderObject =$this-orders[$OrderID=$value]; This line is confusing. $OrderID=$value is either a typo or is just plain wrong. It looks like what it's meant to say is: $OrderObject = $this-orders[$OrderID]; But this will just set $OrderObject equal to $value, so you should

[PHP] Re: php array question

2004-11-01 Thread Victor C.
But why would the this line generate different OrderID on lines 1 and 3? Ben Ramsey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Victor C. wrote: $OrderObject =$this-orders[$OrderID=$value]; This line is confusing. $OrderID=$value is either a typo or is just plain wrong. It

[PHP] Re: php array question

2004-11-01 Thread Ben Ramsey
Ben Ramsey wrote: Victor C. wrote: $OrderObject =$this-orders[$OrderID=$value]; This line is confusing. $OrderID=$value is either a typo or is just plain wrong. It looks like what it's meant to say is: $OrderObject = $this-orders[$OrderID]; But this will just set $OrderObject equal to

[PHP] Re: php array question

2004-11-01 Thread Victor C.
I did a print_r(array_values)before calling the codes that had errors in it.. the following content is contained in $this-orders; Array ( [0] = order Object ( [UserObject] = user Object ( [UserID] = E2401 [Pass] = [IsValid] = 1 [UserType] = AT [fonthtml] = [footerfile] = resources/footer.php

[PHP] Re: php array question

2004-11-01 Thread Ben Ramsey
Victor C. wrote: I did a print_r(array_values)before calling the codes that had errors in it.. the following content is contained in $this-orders; Aaaghh. Can you give that to us in pre-formatted text, rather than copying and pasting it from the browser. My eyes are going everywhere trying

[PHP] Re: php array question

2004-11-01 Thread Victor C.
Hi Ben, I tried your portion of code and find out what was wrong... Apparently I used in adding order to the array and that was messing things up... Everything is working now. Thanks for all the help Victor C. [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I did a

Re: [PHP] Array Question

2004-02-28 Thread Michal Migurski
I would like to search an array to see if the value of the variable $url exists in this array. The array would look like: in_array() - michal migurski- contact info and pgp key: sf/ca

Re: [PHP] Array question

2003-09-27 Thread Robert Cummings
On Sat, 2003-09-27 at 12:18, Robin Kopetzky wrote: Good morning all!! Can you nest an array within an array?? Example: $paArgs['aCheckBoxes[$iIndex]['sName']'] You mean can you retrieve an array entry by giving a key defined by a value in another array? To do so remove the outer quotes in

Re: [PHP] Array question

2003-09-27 Thread Jackson Miller
On Saturday 27 September 2003 11:18, Robin Kopetzky wrote: Good morning all!! Can you nest an array within an array?? Example: $paArgs['aCheckBoxes[$iIndex]['sName']'] Yes, but like this $array['aCheckBoxes'][] = $iIndex['sName'] This means: $array is an array aCheckBoxes is a item in

Re: [PHP] Array question

2003-09-27 Thread Cristian Lavaque
http://www.php.net/manual/en/language.types.array.php If you mean having an array inside an array, of course ? $arr = array(array('data')); ?. There you have an array inside another one, 'data' will be here $var['0']['0']. If you meant using an array item as the key in another array, then you do

Re: [PHP] Array Question

2003-07-28 Thread Jim Lucas
Try this. $companyname[] = $row['company']; Jim Lucas - Original Message - From: Pushpinder Singh Garcha [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 28, 2003 10:16 AM Subject: [PHP] Array Question hello everyone, I am trying to store one of the fields of the

RE: [PHP] ARRAY QUESTION

2003-07-24 Thread Jay Blanchard
[snip] Lets pretend I have this array called myStuff. If I add two elements to myStuff and call the count function, I will get a result of 2. My question is how do I re-initialize the array after adding elements so when I call the count function on the array, I get a result of 0. [/snip] If you

RE: [PHP] ARRAY QUESTION

2003-07-24 Thread Chris W. Parker
Dale Hersh mailto:[EMAIL PROTECTED] on Thursday, July 24, 2003 12:41 PM said: Lets pretend I have this array called myStuff. If I add two elements to myStuff and call the count function, I will get a result of 2. My question is how do I re-initialize the array after adding elements so

Re: [PHP] ARRAY QUESTION

2003-07-24 Thread Curt Zirzow
* Thus wrote Dale Hersh ([EMAIL PROTECTED]): I have a question regarding the count function. Here goes: Lets pretend I have this array called myStuff. If I add two elements to myStuff and call the count function, I will get a result of 2. My question is how do I re-initialize the array after

Re: [PHP] array question

2003-05-30 Thread Randy Johnson
I found this in the manual user comments and it worked great mysql_data_seek($result,0); Randy - Original Message - From: Randy Johnson [EMAIL PROTECTED] To: Brian Dunning [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, May 29, 2003 10:14 PM Subject: [PHP] array question How do

Re: [PHP] Array Question

2003-04-01 Thread skate
look into things like JOIN and SORT BY in MySQL, they're quicker and more efficient than PHP for doing DB stuff (so i'm told) took me awhile to get my head around JOIN, but once you've got it, you'll never be without it ;) Mark McCulligh [EMAIL PROTECTED] wrote in message news:[EMAIL

Re: [PHP] Array Question

2003-04-01 Thread Chris Hayes
At 18:58 1-4-03, you wrote: I have two tables that I want to display together as if they were one table and order them by a common date field. Because I am using MySQL I can't use the usually way I would do this. Create a store procedure or view. Does every row in tableA has a sibling row in

Re: [PHP] Array Question

2003-04-01 Thread Mark McCulligh
I can't link the two tables at all. I need to loop through one displaying its information, then loop through the other table displaying its information. For if I have 5 records in table A and 6 records in table B, I get 11 records total. Each table only has 4-5 fields and they exist in both

Re: [PHP] Array Question

2003-04-01 Thread Mark McCulligh
I have looked at the different JOINs but I can't link any fields together. There is no relationship between the tables. The two table are basically the same table. But the DBA didn't make them one like he should have. Mark. Skate [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] look

Re: [PHP] Array Question

2003-04-01 Thread Tim Burden
. http://www.mysql.com/doc/en/MERGE.html - Original Message - From: Mark McCulligh [EMAIL PROTECTED] Newsgroups: php.general To: [EMAIL PROTECTED] Sent: Tuesday, April 01, 2003 12:33 PM Subject: Re: [PHP] Array Question I have looked at the different JOINs but I can't link any fields

Re: [PHP] Array Question

2003-04-01 Thread Rob Adams
Creating an array that holds the 11 combined records from the two tables, and sorting the array according to date: (This depends on what type your using to store dates in MySQL, and that the exact date is unique for each record across both tables. If the date isn't unique, it requires a little

Re: [PHP] array question

2003-03-10 Thread Jason Wong
On Monday 10 March 2003 21:13, Diana Castillo wrote: If I sort an array, and now the keys are not in numerical order, how can I get the key of the first element? If I do array_shift I get the first element but I want that key. Not very elegant -- there must be a better way? foreach ($doo as

Re: [PHP] array question

2003-03-10 Thread Ernest E Vogelsinger
At 16:35 10.03.2003, Jason Wong said: [snip] Not very elegant -- there must be a better way? foreach ($doo as $key = $value) { print Key:$key Value:$value; break; } [snip] Possibly using array_keys()? $keys =

RE: [PHP] array question

2003-03-10 Thread Ford, Mike [LSS]
-Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED] Sent: 10 March 2003 15:35 To: [EMAIL PROTECTED] Subject: Re: [PHP] array question On Monday 10 March 2003 21:13, Diana Castillo wrote: If I sort an array, and now the keys are not in numerical order, how can I

Re: [PHP] array question

2003-02-24 Thread Chris Edwards
try something like this: $groups= file(group); $number_in_group = count($groups); for( $i = 0; $i $number_in_group; $i++) { $temp = explode(:,$groups[$i]); $group[$i]['pass'] = $temp[1]; $group[$i]['id'] = $temp[2]; $group[$i]['list'] = $temp[3]; } for( $i = 0; $i count( $group

Re: [PHP] array question

2003-02-24 Thread Bob Irwin
Hi Guys, This might be a bit of a newbie question, but I'm not sure how to search for this particular information as its hard to put in search terms. Say I have a mysql/file with information about variables. Eg, I have a string from a mysql database of 'test' Am I able to then, in PHP, assign

RE: [PHP] array question

2003-02-24 Thread Johnson, Kirk
http://www.php.net/manual/en/language.variables.variable.php Kirk -Original Message- From: Bob Irwin [mailto:[EMAIL PROTECTED] Sent: Monday, February 24, 2003 3:28 PM To: php-general Subject: Re: [PHP] array question Hi Guys, This might be a bit of a newbie question

RE: [PHP] Array Question

2002-10-30 Thread Ford, Mike [LSS]
-Original Message- From: PHP List [mailto:php_list;ibcnetwork.net] Sent: 29 October 2002 17:20 To: php Subject: Re: [PHP] Array Question No, array_keys does not do what I want, in order to user array_keys, it assumes I know the value of the key, but I don't, Er -- no. Go

Re: [PHP] array question

2002-10-30 Thread Rick Emery
What happened when you tried both methods? - Original Message - From: John Meyer [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 30, 2002 10:29 AM Subject: [PHP] array question When retrieving an array from $_POST, which is the right way: $arrInterests =

RE: [PHP] array question

2002-10-30 Thread John Meyer
Either way, I'm not getting the interests. -Original Message- From: Rick Emery [mailto:remery;emeryloftus.com] Sent: Wednesday, October 30, 2002 9:34 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] array question What happened when you tried both methods? - Original Message - From

Re: [PHP] array question

2002-10-30 Thread Rick Emery
What does you HTML look like? - Original Message - From: John Meyer [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 30, 2002 10:36 AM Subject: RE: [PHP] array question Either way, I'm not getting the interests. -Original Message- From: Rick Emery [mailto:remery

Re: [PHP] array question

2002-10-30 Thread @ Edwin
Hello, John Meyer [EMAIL PROTECTED] wrote: Either way, I'm not getting the interests. ...[snip]... When retrieving an array from $_POST, which is the right way: $arrInterests = $_POST[interests[]]; or $arrInterests = $_POST[interests]; Try this instead: $arrInterests =

Re: [PHP] array question

2002-10-30 Thread Philip Olson
[EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 30, 2002 10:36 AM Subject: RE: [PHP] array question Either way, I'm not getting the interests. -Original Message- From: Rick Emery [mailto:remery;emeryloftus.com] Sent: Wednesday, October 30, 2002 9:34 AM

RE: [PHP] Array Question

2002-10-29 Thread Ford, Mike [LSS]
-Original Message- From: PHP List [mailto:php_list;ibcnetwork.net] Sent: 28 October 2002 22:48 To: php Subject: [PHP] Array Question Hi, Lets say I have a simple array like this: $myarray = array(a=b,d=c); echo $myarray[0] will return 'b'; How can I get the name of the

Re: [PHP] Array Question

2002-10-29 Thread Brent Baisley
Perhaps you want to look at array_keys(). On Monday, October 28, 2002, at 05:48 PM, PHP List wrote: How can I get the name of the index? -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 --

Re: [PHP] Array Question

2002-10-29 Thread PHP List
No, array_keys does not do what I want, in order to user array_keys, it assumes I know the value of the key, but I don't, I want to get the value of the key but all I know is the index. Perhaps you want to look at array_keys(). On Monday, October 28, 2002, at 05:48 PM, PHP List wrote: How

Re: [PHP] Array Question

2002-10-28 Thread PHP List
This doesn't seem to work for anything past the first key: echo array_search(0,$myarray); will print 'a'; None of these give me anything: echo array_search(1,$myarray); echo array_search(1,$myarray); echo array_search(1,$myarray,true); echo array_search(1,$myarray,true); so how do I get 'd'?

Re: [PHP] Array question

2002-08-14 Thread Bas Jobsen
How can I echo the name of the of the second array (subArray)? The name for value ?php $test=array ( 'a'=array('1','2'.'3'), 'c'=array('6','5'.'4'), 'd'=array('8','9'.'10'),

Re: [PHP] Array question - Finding the name

2002-06-07 Thread Jason Wong
On Friday 07 June 2002 22:16, Phil Schwarzmann wrote: Let's say I have an array... $my_array[] = array('bob' = $x, 'jim' = $y, 'mike' = $z); you probably meant to define it as: $my_array = array('bob' = $x, 'jim' = $y, 'mike' = $z); use print_r($my_array) to see the difference between

Re: [PHP] Array question - Finding the name

2002-06-07 Thread Phil Schwarzmann
Thanks for your reply! I tried using array_slice but I don't think that's exactly that I want to do. I want to find the name of the n-th value in an array. Not the value of the n-th, but whatever name was given to it. Array_slice seems to just pull part of an array and put it in another. and

Re: [PHP] Array question - Finding the name

2002-06-07 Thread Jason Wong
On Friday 07 June 2002 23:59, Phil Schwarzmann wrote: Thanks for your reply! I tried using array_slice but I don't think that's exactly that I want to do. I want to find the name of the n-th value in an array. Not the value of the n-th, but whatever name was given to it. Array_slice

Re: [PHP] Array question - Finding the name

2002-06-07 Thread Philip Olson
I want to find the name of the n-th value in an array. Not the value of the n-th, but whatever name was given to it. Array_slice seems to just pull part of an array and put it in another. and key() isn't exactly what i want either.. Maybe this will help: $my_array = array('bob' = $x,

RE: [PHP] array question

2002-05-30 Thread Martin Towell
$_POST[product][0] $_POST[product][1] etc. -Original Message- From: Michelle [mailto:[EMAIL PROTECTED]] Sent: Friday, May 31, 2002 9:25 AM To: [EMAIL PROTECTED] Subject: [PHP] array question I'm a newbie at php and I'm sure you will be able to tell by my question. I'm just doing a

Re: [PHP] array question

2002-05-30 Thread Analysis Solutions
On Thu, May 30, 2002 at 07:24:49PM -0400, Michelle wrote: pPhone Number:br / INPUT type=\text\ name=\phone\ value=\$_POST[phone]\ size=30/p which finally leads to my question how do I do the $_POST[var] when it's an array(checkbox or radio button)? ex: input type=\checkbox\

Re: [PHP] Array question - Please help

2002-05-23 Thread Jason Wong
On Friday 24 May 2002 01:03, Dan McCullough wrote: Here is the problem. I have over 60 subdomains to check on a regular basis. I wrote a php script that gets a list from a text file and then checks whether it can open that domain/subdomain. That works great. My problem is that everything

Re: [PHP] Array question - Please help

2002-05-23 Thread 1LT John W. Holmes
Write your results to a file and create a mail from the file once a day and send it to yourself with cron, or use a database to hold the results if one is available. Instead of making a mail message with your loop, write information back to the file. Format your file like this: url, pass, fail,

Re: [PHP] array question

2002-05-17 Thread Jason Wong
On Friday 17 May 2002 18:42, Josh Edwards wrote: I have an array which I use a loop to add numbers to different elements in the array. I can extract the highest no which in this case is 48. ie ([22 ] = 48 [23 ] = 2 [12 ] = 22 [14 ] = 5 ) Using this highest no (48 in this instance), how do I

Re: [PHP] Array question

2002-04-23 Thread Michal Dvoracek
Hello, i think that unset($a['color']); is the best way :) Regards Michal Dvoracek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Array Question

2002-04-19 Thread Erik Price
On Thursday, April 18, 2002, at 05:38 PM, Jason Lam wrote: But, $arr1[0] = 1; $arr1[1] = 10; $arr2[0] = $arr1; $arr3 = each($arr2); print $arr3[1]; Result is not 10. So, function each is not taking the whole $arr2[0] out.. My question is what function should I use to iterate

Re: [PHP] Array Question

2002-04-18 Thread Steve Cayford
On Thursday, April 18, 2002, at 04:38 PM, Jason Lam wrote: $arr2 is a 2d array. $arr1[0] = 1; $arr1[1] = 10; $arr2[0] = $arr1; print $arr2[0][1]; Result will be 10 But, $arr1[0] = 1; $arr1[1] = 10; $arr2[0] = $arr1; $arr3 = each($arr2); print $arr3[1]; What are you expecting?

Re: [PHP] Array Question

2002-03-26 Thread Jim Lucas [php]
PROTECTED] To: 'John Fishworld' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, March 26, 2002 10:07 AM Subject: RE: [PHP] Array Question $n =sizeof($state); $srch = ; while( $x=0; $x$n; $x++) { ... do something with array element $state[$x] ... $srch .= $state[$x]., ; } $srch

RE: [PHP] array question

2001-07-19 Thread Taylor, Stewart
Try using mysql_fetch_array instead of mysql_fetch_object. You then then use a simple loop to assign your variables e.g. foreach($row as $k=$v) { $GLOBALS[$k] = $v; // or $GLOBALS[$k][$i++] = $v if multiple records being read } This will result in a set of global variables matching your

Re: [PHP] Array question

2001-05-16 Thread David Robley
On Thu, 17 May 2001 08:26, Matthias Roggendorf wrote: Hi, I wrote some code and I do not understand the result I get: while ($data = fgetcsv ($fp, 1000, ,)) $line[$j++] = $data; When I ouput $line[0][0] I get Array[0] instead of the real value. Why is that? Thanks for your help,

Re: [PHP] array question

2001-02-23 Thread Christian Reiniger
On Friday 23 February 2001 17:02, Jeff wrote: Is there better performance/speed instantiating an array with a specified size and then adding elements versus adding elements to an array with no size? Uh, you can't specify the size when instatiating an array ... -- Christian Reiniger LGDC

Re: [PHP] Array question

2001-02-15 Thread Christian Reiniger
On Thursday 15 February 2001 01:40, Chris wrote: How do I get the index,number of an array if reffering to an array via string? Ex: I have 100 arrays, and I want to know what # myarray["something"] is. That element doesn't have an index number such arrays are implemented as hashes or

Re: [PHP] Array question

2001-02-15 Thread Chris
Ok, But can't the array still be refered to with a number? So in myarray["something"] is the 50th element in the array, wouldn't: myarray[49] = myarray["something"] ? On Thursday 15 February 2001 01:40, Chris wrote: How do I get the index,number of an array if reffering to an array via