Method¶
Methods are function dedicated to a class. They are defined inside the body of a class, and may only be access in relation to that class : via an object, the class name or another method.
<?php
class x {
public function foo() {
echo "I am foo!\n";
}
}
$x = new Y();
$y->foo(); // calling the foo method, defined in x,
?>
Related : Class, __call() Method, Default Parameter, Fossilized Methods, Functions, Return, Static Method, Visibility