-1

Possible Duplicate:
Reference - What does this symbol mean in PHP?

Take this snippet of code for instance:

$files[] = array('name' => $d, 'tmp_name' => $fdata['tmp_name'][$i]);

What is the specific definition, name and usage of what only appears to be the operator =>

Community
  • 1
  • 1

3 Answers3

0

It's the separator for key-value pairs in arrays. See the docs for more details

ernie
  • 6,164
  • 20
  • 27
0

The => is an array assignment operator. When you're creating an array with both keys and values, the => maps the key to a value.

For instance:

$example = array("Person" => "SomeKittens");
$example["Person"]  === "SomeKittens"; //true
isset($example[0]);//false.  The 0 index was never set.
SomeKittens
  • 35,809
  • 19
  • 104
  • 135
0

It is an assignment operator used in array definitions.

$someVar=array('key1' => 3, 'key2' => 6);

The output is an array with an element called 'key1' and the value of 3 and a second one called 'key2' with a value of 6.

Fluffeh
  • 31,925
  • 16
  • 62
  • 77