EChan42 EChan42 - 2 years ago 98
PHP Question

"->" or "=>" in laravel

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);


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

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

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download