What does => mean in php?

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

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


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

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']

链接地址: http://www.djcxy.com/p/58172.html

上一篇: 什么是=>标志用于

下一篇: 什么= =在PHP中的意思?