Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "->" mean in php? [duplicate]

Tags:

php

Possible Duplicate:
Reference - What does this symbol mean in PHP?

What exactly does -> do in php?

I have a good understanding of the basics of php but never understood this. I tend to see in apps that use Codeignitor.

like image 337
codedude Avatar asked Dec 27 '22 17:12

codedude


1 Answers

It accesses accessible child methods or properties of objects:

class myClass {
  public $fizz = 'Buzz';
  public function foo() {
    echo 'Bar';
  }
}

$myclass = new myClass();
$myclass->foo(); // outputs 'bar'
$myclass->fizz = 'Not Buzz'; // overwrites $fizz value
like image 132
Sampson Avatar answered Jan 12 '23 02:01

Sampson