Tag: array

February 24, 2006 / PHP & Web Development

I just saw a forum post asking the difference between -> and => and it’s one of those tricky questions to research, just how can a search engine understand what you’re asking?

Well, luckily the answer is quite simple.

-> is used by objects to set, get or call a method of that object.
Ref: Chapter 18. Classes and Objects (PHP 4)

=> is used by arrays to describe the relationship between the key and the value
Ref: Arrays

Here’s an example of how the -> is used in a class