[SOLVED] Simple Quick 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
User avatar
lazersam
Forum Contributor
Posts: 105
Joined: Sat Nov 15, 2003 4:07 am
Location: Hertfordshire, UK

Simple Quick Array Question

Post by lazersam »

Hi, I know I should know this but I haven’t used arrays in ages and can not find this solution in my books....

Simply, I have built an array as follows

Code: Select all

$list = array();
$listї3]="50"; $listї29]="45";$listї67]="89";
I am trying to read the 'list' array and its keys back. I need to know that 3=50, 29=45 and 67=89.

I do not want to loop from 0 to 67. I only want to loop three times and retrieve the keys and data.

Could someone give an example on how I could do this?
Last edited by lazersam on Sat Sep 11, 2004 6:20 am, edited 1 time in total.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

[php_man]array_keys[/php_man]
User avatar
lazersam
Forum Contributor
Posts: 105
Joined: Sat Nov 15, 2003 4:07 am
Location: Hertfordshire, UK

Post by lazersam »

Wow - thanks!
Post Reply