many times I've seen this symbol ->
What is it? seems a logical operator or something
Complete example:
get_categories->category_count
many times I've seen this symbol ->
What is it? seems a logical operator or something
Complete example:
get_categories->category_count
It's called the object operator
.
For example:
$myObject = new stdClass();
$myObject->Hello = "world";
echo $myObject->Hello; //Returns world
You can also use this operator to call properties or methods from classes. For example:
Class MyClass {
public function hello(){
return "world";
}
}
echo (new MyClass())->hello(); //Returns world
It is called as PHP object operator (T_OBJECT_OPERATOR).
Example:
$car = new Car();
$car->color = 'Red';
echo $car->color; // returns the color of the car.