Possible Duplicate:
Reference - What does this symbol mean in PHP?
I've been programming with PHP for a bit now, but every once in a while I run across these two expressions:
->
=>
What are these and what do they mean/do? I don't even know what to call them in order to find out...
-> is used to access instance attributes of objects. It is the equivalent to the . syntax in many other languages (C, C++, Python, Javascript).
$myclass->my_instance_var;
$myclass->my_instance_method();
=> is used to map keys to values in associative arrays. It is the equivalent of : in a mapping in Python and Javascript.
$arr = Array("Hello" => "World", "Foo" => "Bar");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With