ok, have you covered arrays? I will assume you have for the moment. Otherwise, the following will only confuse you. :p
AFAIK, as is only used in a foreach() statement.
Let's say that you have an array of people's names and that you want to correctly capitalise each name (for the moment we'll exclude Scottish People who are McSomething for simplicty).
One way of doing it, would be as follows.
/* The names are defined below. I prefer to write arrays out like that to ensure they're easy to read, but the format is up to personal preference. Because you may have a different monitor size to me, I'm using /* instead of // to comment. (So you can see that all this is actually supposed to be one line) */
$people = array(
'JAsmine',
'cROwsteN',
'sylvester',
'aPple',
'Snoopy'
);
/* Next, we want to look at each item in the list and correct the capitialisation. */
foreach( $people as $person )
{
/* What's happened here? Well, this is a special kind of loop that loops through each item in the array $people, and assigns the value each time to $person. So, the first time this loops, $person will be equal to 'JAsmine'. The next; 'cROwsteN', and so forth. */
echo '<br />Person: ' . ucfirst(strtolower($person));
/*That essentially turns the value of $person to completely lower case (strtolower) and then changes the first letter to upper case (ucfirst), the echos it following '<br />Person: '. */
}
Ok, now, suppose for some reason, you want to actually know which index that person had and echo that along with it? Well, you can do a similar thing like so:
$emails = array(
'bob' => 'bob@bobby.com',
'rob' => 'rob@rob.com',
'me' => 'me@you.com'
);
foreach( $emails as $name => $email )
{
echo "{$name}'s email is $email. <br />";
}
Will echo something like:
bob's email is bob@bobby.com
rob's email is rob@rob.com
etc...
I hope that clears up any confusion.