PHP: What is the meaning of the arrow -> in PHP?
Question by Guest | 2015-07-07 at 18:21
I have already worked with several programming languages, but I am quite new with PHP. Nevertheless, I was able to find my way in the PHP syntax quite quickly, because many things are similar to other languages.
However, not all. For example, in some code examples, I was confronted with an arrow, written as a hyphen character and a greater-than-sign (->). I have never seen something like that in other programming languages.
Is someone able to explain the meaning of this arrow in PHP to me?
Related Topics
jQuery: Assign Action to Keyboard Keys (Keyboard Event)
Tip | 0 Comments
HTML Form: Redirection depending on Radiobutton or Checkbox State
Tutorial | 0 Comments
HTACCESS: Simplify URL
Tutorial | 0 Comments
PHP: Current Date and Time
Tutorial | 0 Comments
Meaning of R in Status Bar of Smartphone
Question | 3 Answers
What is the meaning of superscript corners ^^ as smiley?
Question | 1 Answer
Meaning of AFAIK?
Question | 1 Answer
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
With the arrow, you can access methods, functions and properties of classes in PHP. In other programming languages, often the period is used for this.
Here is a small example for PHP:
We are creating a new object of the class MyClass and afterwards we are accessing the functions getString() and getInt() in order to store the results in the variables $str and $int. After that, we are calling the method doSomething.
In another programming language, the same example might look something like that:
Basically, it is the same, only with a dot instead of the arrow.
2015-07-07 at 19:10