0

Possible Duplicate:
What does “=>” mean in PHP?

I'm learning about arrays and am not certain what => means or does.

Community
  • 1
  • 1
Keith Groben
  • 301
  • 2
  • 3
  • 15
  • 5
    Have you seen the manual about arrays? Also see [Reference - What does this symbol mean in PHP?](http://stackoverflow.com/questions/3737139/reference-what-does-this-symbol-mean-in-php) – BoltClock Feb 02 '11 at 07:39
  • This question is already answered here http://stackoverflow.com/questions/1241819/what-does-mean-in-php?rq=1 – Aidan Jan 15 '14 at 22:38

2 Answers2

1

Assignment of a value to a named key.

http://www.php.net/manual/en/language.operators.assignment.php

$example = array('color' => 'blue');
echo $example['color']; //prints blue
Dan Grossman
  • 51,866
  • 10
  • 112
  • 101
0

I believe it is just syntax for writing array literals that behave like maps / dictionaries.

$mydict = array('hello' => 'world');

The above is an array with one element. But instead if indexing that element with an integer index, you use the key 'hello':

echo $mydict['hello']

Daren Thomas
  • 67,947
  • 40
  • 154
  • 200