" mean in php? Possible duplicate: Link - what does this symbol mean in PHP? What exactly does → do in php? I am well versed i...">

What does "->" mean in php?

Possible duplicate:
Link - what does this symbol mean in PHP?

What exactly does → do in php?

I am well versed in the basics of php, but never understood. I usually see in applications that use Codeignitor.

+4
source share
5 answers

-> refers to varible inside the class, so

$ class-> variableInClass

It can also work with functions with the same syntax as above.

If you are not familiar with OOP, I suggest looking here

+1
source

Access to available child methods or object properties:

class myClass { public $fizz = 'Buzz'; public function foo() { echo 'Bar'; } } $myclass = new myClass(); $myclass->foo(); // outputs 'bar' $myclass->fizz = 'Not Buzz'; // overwrites $fizz value 
+4
source

I am sure this is a more technical explanation, but it is used to access the properties and methods of an object.

+3
source

This is basically equivalent . in javascript. Both possess properties / methods of objects.

The biggest difference is that only in PHP class es are there objects. Although in JavaScript everything is an object.

Therefore, you cannot make "string"->method() in php, whereas you can make the equivalent in JavaScript of "string".method() .

+2
source

Well, I would piss you off, because it's a very common operator. However, it is very difficult for Google, so I understand.

This is a class access statement. It allows you to access members and class functions. For example, if I have a class named A with member x, I could access it as follows:

 $a = new A(); $a->x; 
0
source

All Articles