RE: Add to array problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

$items=array();

Sets $items to an array with nothing in, so if you had anything in there
previously, its gone.

Here is the example from the help file.

<?php
$stack = array("orange", "banana");
array_push($stack, "apple", "raspberry");
print_r($stack);
?>

Array
(
    [0] => orange
    [1] => banana
    [2] => apple
    [3] => raspberry
)

Chris.

-----Original Message-----
From: mayo [mailto:mayo@xxxxxxxxxxxxxxxxxx]
Sent: 16 May 2005 15:26
To: php
Subject:  Add to array problem


I'm having a little problem adding to an array. Each time I add to an
array it wipes what was previously added. I'm using array_push().

$items=array();
$items=array_push($items, $_POST["whatever"]);

I'm missing something easy.

thx




************************

This message has been delivered to the Internet by the Revenue Internet e-mail service

*************************

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux