JochenJung
2010-08-06 14:38:10
More specifically: it's for class *instances*.
strager
2010-08-06 14:38:58
+4
A:
The -> is used with object methods/properties, example:
class foo{
function bar(){
echo 'Hello World';
}
}
$obj = new foo;
$obj->bar(); // Hello World
More Info:
Sarfraz
2010-08-06 14:38:42
+1
A:
-> operator access properties and methods of an object.
Probably you should read PHP OOP introduction: http://php.net/manual/en/language.oop5.php
gustavogb
2010-08-06 14:39:07
+1
A:
Expanding on sarfraz's answer to demonstrate how to access properties:
class foo{
public $value = "test";
function bar(){
//// code
}
}
$obj = new foo;
$obj->bar();
echo $obj->value; //displays "test"
Chris
2010-08-06 14:40:32