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
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 =
[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
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
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
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
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
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';
-
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
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
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
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
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
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:
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
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
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
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;
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
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.
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
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
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
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]=
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
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:
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
[EMAIL PROTECTED] wrote:
$count=count($data-legs-leg);
$k=0;
while($k $count)
{
$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
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:
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
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,
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
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
: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
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 )
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
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
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
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
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
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
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
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
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
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
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
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
[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
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
* 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
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
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
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
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
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
.
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
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
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
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 =
-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
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
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
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
-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
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 =
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
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
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 =
[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
-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
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
--
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
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'?
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'),
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
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
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
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,
$_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
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\
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
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,
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
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
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
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?
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
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
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,
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
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
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
93 matches
Mail list logo