Example of an Array:

$my_first_array = array(1 => 'first', 2 => 'second', 3 => 'third');

You can now access these like so:

echo $my_first_array[1];   etc etc

of if you had this:  $my_first_array = array('first_name' => 'Philip',
'last_name' => 'Newman');

You could do this:

echo $my_first_array['first_name'];

The thing to remember is that array's start at 0 "see below!!" (I started at
1 at the top to make it easier).

You can also make an array like so:

$first[] = 'Philip';
$first[] = 'John';
$first[] = 'Paul';

Now you can simply do:

echo $first[0];  // this could output 'Philip';

You can then look at multi dimensional etc...

I trust this get's you on your way.


Timothy Hitchens (HiTCHO)
[EMAIL PROTECTED]


HiTCHO | Open Platform Web Development
Consulting - Outsourcing - Training - Support


----- Original Message -----
From: "Philip J. Newman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 01, 2003 2:57 PM
Subject: [PHP] makeing an array


> Can someone help me make an array ...
>
> I have $foo amount of loops to preform (1-20), and would like to make the
> veriable work for me like $comment_1, $comment_2 etc etc.
>
> http://nz.php.net/manual/en/function.array.php makes no sence to me after
i
> read it and read it ...
>
> help me please
>
> ---
> Philip J. Newman.
> Head Developer.
> PhilipNZ.com New Zealand Ltd.
> http://www.philipnz.com/
> [EMAIL PROTECTED]
>
> Mob: +64 (25) 6144012.
> Tele: +64 (9) 5769491.
>
> VitalKiwi Site:
> Philip J. Newman
> Internet Developer
> http://www.newman.net.nz/
> [EMAIL PROTECTED]
>
> *****************************
>   Friends are like Stars,
>   You can't always see them,
>   But you know they are there.
>
> *****************************
>
> ICQ#: 20482482
> MSN ID: [EMAIL PROTECTED]
> Yahoo: [EMAIL PROTECTED]
> AIM: newmanpjkiwi
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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

Reply via email to