codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?php class ChainMe { public function hello() { echo 'Hello '; return $this; } public function good($is = false) { if ($is === true) { echo 'beautiful '; } return $this; } public function day() { echo "world!\n\n"; return $this; } } $happy = new ChainMe(); $happy ->hello() ->good(true) ->day(); $meh = new ChainMe(); $meh->hello()->good()->day(); ?>
Private
[
?
]
Run code
Submit