Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read aloud "->" or "::" sign in PHP OOP? [duplicate]

Tags:

oop

php

We often use $class_object->class_procedure or self::class_procedure in PHP OOP. While reading aloud your code, how do you read out these conventions?

like image 588
Ruturaj Avatar asked Jan 16 '13 03:01

Ruturaj


1 Answers

-> is the object operator. Typically called the arrow in conversation. If I were reading the code, I might say:

class object arrow class method

:: is the static resolution operator. I doesn't read as well in conversation. The docs say double colon. I might say:

class colon colon static method

Note: Reading code aloud can be awkward regardless of how you name syntax. Furthermore, it will depend greatly on your audience. I am sharing what I've heard, seen used in books, or found in the docs.

like image 149
Jason McCreary Avatar answered Oct 05 '22 23:10

Jason McCreary