How do you call "->"

I call “-” minus.
I call “=” equal.
For example, in the code below

try {
$dbc = new PDO("mysql:host=localhost;dbname=$dbName;charset=utf8", "root", "*******", $options);
} catch(PDOException $e) {
throw new PDOException($e->getMessage(), (int)$e->getcode());
}

I calls “=” “equal” in the above.
I don’t know how to call "".
How do you call it?
I can call it “arrow to rightward” but I think it’s very long when I read the code.
How do you call ""?

Nicked from a signature on another forum:

A good way to remember objects from arrays is you shoot objects with arrows

Example: $name->id; then Arrays are $name[‘id’];

When I read the code above,
Do you mean the quote below is a good way?

No because one is a class public variable and the other is a class public method.

Check on the free online PHP Manual for examples on how to use class public variables and class public methods.

https://www.php.net/manual/en/language.oop5.php

1 Like

In the PHP world, there’s arrays and there’s objects. Arrays in PHP are called or referenced in similar ways to other programming languages. This being enclosed in square brackets (e.g. ['value']). Objects on the other hand are something entirely different. They are referenced by instantiating a class which holds that object. Objects have something I call “visibility scopes” (public, protected, private) which tells the language what it can access and what it can’t. Arrays don’t have such a thing because arrays are what you can consider, a list of items. You can consider objects as a noun.

Pretty sure you are not asking how to use → or what it is. You just want to know how to ‘pronounce’ it when reading code. And I don’t have a good answer for that.

For some reason I always call it “underscore equals” when mentally reading code. Which of course makes no sense at all but it hard to break 40 years (same operator is used in C/C++) of habit.

2 Likes

The quotes above are goog information to understand and remember. Thank you.
By the way, there are, I guess, something unclear in my original question.

I heard that native speaker of English pronounces SQL as sequel.

My original question was how you do pronounce "" instead of "how do you call "".

I always say “pijltje” in Dutch. Literally in English that would be “little arrow”, but if I were to say it in English I’d probably just say “arrow”.

1 Like

I try very hard to not do that, just like to me the C-call snu() is pronounced “ess enn you”, not “snoo”.

I suspect you might be referring to native speakers of American. :slight_smile:

hehe.

Sequel is a common way of saying SQL in actual speech, yes. The Standard says it’s pronounced as the acronym, ess-cue-ell.

How do you call "->"
Normally, I wouldnt. It’s like a comma, you dont say the word “comma” in the middle of your sentence unless you’re dictating.

It would depend on the context of the sentence as to how I would phrase $e->getcode(). Most likely, “On the error object call getcode”. So you could say in that sentence I was saying “call”, but if it was a property ($a->member), I would probably say something like “Get the member from a” or “a’s member” (In which case the → becomes the possessive, I suppose). If i was dictating a script, I would call it an arrow.

It was my mistake.

Like I said in the other topic you started, it has many names. In C++ and C, most people call it the “arrow operator”. Others have a different name for it.

Then this complicates things :slightly_smiling_face:

$array = ('key' => 'value');

Interesting question though, as I don’t know what to call it, though I would probably call it an arrow.

But the comma has a name, “comma”.

For ages, I never knew that. I think because I very rarely speak (as in actual speech) to other developers, so never heard it said. I mostly (certainly starting out learning) work alone and communication is usually in writing, such as in the forums here. So when I have spoken about it, it seems strange to me.

1 Like

Throw another odd one at you - my natural tendency changes depending on the context. I will pronounce “SQL” as “Sequel”, but “MySQL” as “My Ess Cue Ell”.

shrug

1 Like

Sequel vs. Ess Cue Ell

Sounds like a matchup I would watch.

[off-topic]
Reminds me of:

You Say Tomato, I say Tomato

[/off-topic]

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.