Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between :: and -> in PHP? [duplicate]

Tags:

php

Possible Duplicate: What's the difference between :: (double colon) and -> (arrow) in PHP?
Reference - What does this symbol mean in PHP?

I'm quite decent with PHP, but only procedural. So I decided to venture forth into learning object oriented. I'm getting the hang of it, and liking it quite well.

On PHP.net, I've always seen object oriented as mysqli::query.

However, every example I've seen uses mysqli->query as well as what I have always used.

Today, I ran across actually seeing :: used in a class example.

So now, my question is, is there a difference between :: and ->? Is it like the difference between " and '?

like image 247
Oberst Avatar asked Dec 16 '12 01:12

Oberst


1 Answers

:: is for calling static methods, -> is for instance methods

like image 188
Robin Kanters Avatar answered Sep 29 '22 21:09

Robin Kanters