array question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rubberjohn
Forum Contributor
Posts: 193
Joined: Fri Feb 25, 2005 4:03 am

array question

Post 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
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Code: Select all

echo $array_name[0];

echo $array_name[1];
rubberjohn
Forum Contributor
Posts: 193
Joined: Fri Feb 25, 2005 4:03 am

soz

Post by rubberjohn »

sorry i should have said that the size of the array is unknown
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

gskaruz
Forum Newbie
Posts: 8
Joined: Mon Mar 15, 2004 6:45 am

Post by gskaruz »

Code: Select all

for(reset($_POST); $key = key($_POST); next($_POST))
	{
		echo $key." - ". $_POST[$key]."<BR>";
	}
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Code: Select all

while (list($key,$value) = each($array_name))
{
 echo $value;
}
Post Reply