Single arrow - T_OBJECT_OPERATOR
->
This is used for access to an object property and the value associated with that property.
$object->property='value'
I have a dog and his name is Captain
$dog->name='Captain';
Now I have access to properties of my dog. The property that we have set is name
$dogName=$dog->name;
echo $dogName;
Will output: Captain
I can also add other properties and their associated value to my object.
$dog->weight='57lbs';
Now my object has two properties associated with it, name and weight.
Double arrow - T_DOUBLE_ARROW
=>
As is stated in the documentation an array is just a map of comma separated keys and the values associated with the key. The double arrow is essentially an assignment operator that assigns, or associates, the value to a key.
$array = array("key" => "value");
Again using the dog example.
$dog = array("name" => "Captain", "weight" => "57lbs");
And we can access values in my dog array by the respective keys.
$fatDog = $dog["weight"];
echo $fatDog;
Will output: 57lbs
Combinations of single and double arrow
$object->property=>$value;
This combines object/property with key/values. If we break it down into it's constituents it can make things much more clear.
We know that $object->property
will yield the value associated with the property. Lets start by associating that with a variable:
$valueAssociatedWithProperty = $object->property;
Using substitution into the original gives:
$valueAssociatedWithProperty => $value;
We have seen that before it is just the key/value of an array! Lets apply this to the dog example and see what comes out:
$dog->name="Captain";
$description="He is crazy";
$array = array($dog->name => $description);
// $array = array("Captain" => "He is crazy");
$whatIsCaptain = $array["Captain"];
echo $whatIsCaptain;
He is crazy
I hope this helps.
Also look HERE for all the references you could ever hope for!