> 
> **Possible Duplicate:**  
> 
> [PHP method chaining?](https://stackoverflow.com/questions/3724112/php-method-chaining) 
> 
> 
> 

In a lot of APIs I've worked with, I've seen this sort of thing:

```
$object->method()->anotherMethod();

```

From the tutorials on OOP that I've read, this is how classes are written, 

```
<?php
class myClass {
    public method() {
       // do something
    }
}
?>

```

When should this be used, and how can it be done? Apologies, but I am new to OOP.