开发者

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

开发者 https://www.devze.com 2023-02-23 07:31 出处:网络
This question already has answers here: 开发者_开发百科 Closed 10 years ago. Possible Duplicate: What does “=>” mean in PHP?
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

精彩评论

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

关注公众号