Design a site like this with
Get started

Object Operators in PHP


There are two object operators in PHP. The symbols are -> and ::

-> Operator

The object operator -> is used when you have to access an Instance property or call a method just like a dot (.) in other languages. For example, if there is a ‘Students’ class that includes the method ‘Marks’, we access it by creating an object say ‘Student’. In other languages:


In PHP, The object operator -> is used for this purpose e.g.


:: or scope resolution operator

:: or scope resolution operator is used when you want to call a static method, variable or a parent class’s version of a method within a child class. It is called scope resolution operator as it is used to refer the scope of some program context or a block e.g. classes, objects, namespace etc.

For example,

class Students
function getMarks()
   return $marks;
$marks = Students::getMarks();

:: operator is used when the object has not been created until the class functions or variables are accessed outside the scope of the class.


2 thoughts on “Object Operators in PHP

Add yours

  1. I see you don’t monetize, don’t waste your traffic, you can earn additional bucks every month with new
    monetization method. This is the best adsense alternative for any type of website (they approve all sites), for more
    details simply search in gooogle: murgrabia’s tools

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a free website or blog at

Up ↑

%d bloggers like this: