Fwd: [PHP] What does this mean?
| From: | Eddie Drapkin | Date: | Fri, 26 Jun 2009 06:36:29 +0000 |
| Subject: | Fwd: [PHP] What does this mean? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-294632@lists.php.net to get a copy of this message | ||
Just getting this back on the list >.>
---------- Forwarded message ----------
From: Eddie Drapkin <oorza2k5@gmail.com>
Date: Fri, Jun 26, 2009 at 2:36 AM
Subject: Re: [PHP] What does this mean?
To: Jason Carson <jason@jasoncarson.ca>
It's used in key value combinations in several places.
When building an array:
$foo = array('key' => 'value', 'another_key' => 'another
value');
which will give you an array that looks like
$foo['key'] = 'value';
$foo['another_key'] = 'another_value';
Also, in foreach(), which is a language construct used to iterate over arrays:
foreach($foo as $key => $val) {
echo "The key for this element is $key and the value is $val\n";
}
will output:
The key for this element is key and the value is value
The key for this element is another_key and the value is another_value
Those are the two most common places you'll see it (and perhaps the
only, I don't want to speak conclusively, though, I'm awfully tired
this evening!)
On Fri, Jun 26, 2009 at 2:31 AM, Jason Carson<jason@jasoncarson.ca> wrote:
> Hey all, I'm new to the list and I have a question...
>
> What does => mean?
>
> The book I am reading is called Programming PHP published by O'Reilly. I
> haven't read the whole book yet. I was flipping through the pages and in
> the book there is mention of <= (less than or equal) and >= (greater than
> or equal)but it doesn't say what => is even though it is used numerous
> times in the example code.
>
> Thanks
>
> Jason
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>