开发者

What is this operator "=>"? [duplicate]

This question already has answers here: 开发者_开发百科 Closed 10 years ago.

Possible Duplicate:

What does “=>” mean in PHP?

Reference - What does this symbol mean in PHP?

I see this symbol in a lot of PHP code.

I can't figure out what it means or what it does..

Is it really an operator ?


Do you mean =>? If so, it's for initializing array keys (or indexes if you prefer). Like this:

$values = array(
    'foo' => 'bar'
);

This will initiazlie an array with a key named foo with a value of bar.

Read more on about arrays at php.net.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜