RE: novice question -- array_push($real[$i][$j],$s[$j]);????????
| From: | Tim Ward | Date: | Wed, 20 Feb 2002 15:23:51 +0000 |
| Subject: | RE: novice question -- array_push($real[$i][$j],$s[$j]);???????? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-85538@lists.php.net to get a copy of this message | ||
Array_push() takes an array as it's first parameter. In your case you have
an array of arrays (NOT a 2 dimensional array) and to add an element on to
the end of one of them you need to pass the name of the element of the top
level array you want to add an element to into the function.
I.e. if you have
$fred[0] = array(1,2,3);
$fred[1] = array(4,5,6);
array_push($fred[1], 7)
will leave
$fred[0] = array(1,2,3);
$fred[1] = array(4,5,6,7);
or
array_push($fred[0], 7)
will leave
$fred[0] = array(1,2,3,7);
$fred[1] = array(4,5,6);
Tim Ward
www.chessish.com <http://www.chessish.com>
----------
From: brendan conroy [SMTP:brendanconroy80@hotmail.com]
Sent: 20 February 2002 12:27
To: php-general@lists.php.net
Subject: novice question --
array_push($real[$i][$j],$s[$j]);????????
Hi, thanks for reading this,
Iam trying to push elements into a two dimentional array, but I cant
find
the proper syntax, I'd be grateful if someone could email me the
proper
method. Iam using the normal method, which worked fine for a one
dimentional
array, but when I use it for a two dimentional array, it doesnt seem
to
recognise that is an array, even though I initialized the array with
$real[0][0] = 0;.
Thanks a million for your time,
Bren
_________________________________________________________________
Get your FREE download of MSN Explorer at
http://explorer.msn.com/intl.asp.