I see these in PHP all the time but I don't have a clue as to what they actually mean. What does -> do and what does => do. And I'm not talking about the operators. They're something else, but nobody seems to know...
 
    
    - 7,107
- 6
- 31
- 43
 
    
    - 2,655
- 3
- 13
- 4
- 
                    36@Harry: Google doesn't work too well with symbols: http://www.google.com/search?q=php+%3D> – Blender Dec 26 '12 at 07:20
- 
                    56It's not super helpful for a question to be marked as "duplicate" with a link to a question which is closed for being unhelpful. – brentonstrine Feb 06 '15 at 17:49
- 
                    2@Harry it works in 2021, searching 'php =>' brought me here – mhrsalehi Feb 13 '21 at 18:53
4 Answers
The double arrow operator, =>, is used as an access mechanism for arrays. This means that what is on the left side of it will have a corresponding value of what is on the right side of it in array context. This can be used to set values of any acceptable type into a corresponding index of an array. The index can be associative (string based) or numeric.
$myArray = array(
    0 => 'Big',
    1 => 'Small',
    2 => 'Up',
    3 => 'Down'
);
The object operator, ->, is used in object scope to access methods and properties of an object. It’s meaning is to say that what is on the right of the operator is a member of the object instantiated into the variable on the left side of the operator. Instantiated is the key term here. 
// Create a new instance of MyObject into $obj
$obj = new MyObject();
// Set a property in the $obj object called thisProperty
$obj->thisProperty = 'Fred';
// Call a method of the $obj object named getProperty
$obj->getProperty();
 
    
    - 17,074
- 5
- 83
- 129
 
    
    - 4,451
- 2
- 12
- 13
- 
                    171
- 
                    107
- 
                    163
- 
                    103
- 
                    101
- 
                    53
- 
                    13
- 
                    17
- 
                    13
- 
                    7
- 
                    23
- 
                    4Use -> operator to "access" Object Properties , Use => operator to "assign" values to an Object Property. – Odai A. Ali Apr 06 '20 at 08:34
- 
                    4:: is also like . in Java but only when accessing method or variable statically. Math.PI in java would be Math::PI in PHP (if there was a Math class with a PI variable) – Brent Sandstrom Apr 06 '20 at 18:28
- 
                    11
- 
                    8
- 
                    13
- 
                    9
- 
                    7
- 
                    6
- 
                    6So -> is like -> in c++ for pointer of object and . for object itself – mhrsalehi Feb 13 '21 at 18:58
- 
                    7
- 
                    2so I up vote all the comment like the . (dot : less typing means do more) – Yohanim Mar 26 '21 at 10:54
- 
                    8
- 
                    2
-> is used to call a method, or access a property, on the object of a class
=> is used to assign values to the keys of an array
E.g.:
    $ages = array("Peter"=>32, "Quagmire"=>30, "Joe"=>34, 1=>2); 
And since PHP 7.4+ the operator => is used too for the added arrow functions, a more concise syntax for anonymous functions.
 
    
    - 453
- 5
- 15
 
    
    - 1,554
- 13
- 33
=> is used in associative array key value assignment.  Take a look at:
http://php.net/manual/en/language.types.array.php.
-> is used to access an object method or property.  Example: $obj->method().
 
    
    - 9,258
- 4
- 36
- 53
->
calls/sets object variables. Ex:
$obj = new StdClass;
$obj->foo = 'bar';
var_dump($obj);
=> Sets key/value pairs for arrays. Ex:
$array = array(
    'foo' => 'bar'
);
var_dump($array);
 
    
    - 16,620
- 7
- 50
- 62