0

I find myself using -> and => in different scenarios while programming in PHP and I would like to know the difference between these two operators.

Two examples would be:

Cache::section('group')->put('key', $value);

and

return Response::json(array('key' => 'value'));

Just for reference I'll state I use Laravel as my framework.

Tuim
  • 2,421
  • 1
  • 13
  • 31
EChan42
  • 139
  • 6

1 Answers1

5

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

=> adds key => value into an array. -> calls method on object or gets object property.

Pᴇʜ
  • 53,845
  • 9
  • 46
  • 68
Alexey Mezenin
  • 148,626
  • 22
  • 267
  • 261