1<?php
2class fakeString
3{
4 private $str;
5 function __construct()
6 {
7 $this->str = "";
8 }
9
10 function addA()
11 {
12 $this->str .= "a";
13 return $this;
14 }
15
16 function addB()
17 {
18 $this->str .= "b";
19 return $this;
20 }
21
22 function getStr()
23 {
24 return $this->str;
25 }
26}
27
28
29$a = new fakeString();
30
31
32echo $a->addA()->addB()->getStr();