Page 1 of 1
array question
Posted: Wed Mar 30, 2005 8:12 am
by rubberjohn
how do you return the values of an array without using a for loop and without getting the following output:
Code: Select all
Array
(
ї0] => XL
ї1] => gold
)
sorry if this is basic but ive been working for ages now and my brain has stopped working
cheers
Posted: Wed Mar 30, 2005 8:26 am
by JayBird
Code: Select all
echo $array_name[0];
echo $array_name[1];
soz
Posted: Wed Mar 30, 2005 10:12 am
by rubberjohn
sorry i should have said that the size of the array is unknown
Posted: Wed Mar 30, 2005 10:17 am
by JayBird
Posted: Thu Mar 31, 2005 4:14 am
by gskaruz
Code: Select all
for(reset($_POST); $key = key($_POST); next($_POST))
{
echo $key." - ". $_POST[$key]."<BR>";
}
Posted: Thu Mar 31, 2005 4:40 am
by anjanesh
Code: Select all
while (list($key,$value) = each($array_name))
{
echo $value;
}