Reputation: 45
how i can create class with this call syntax
oop->open(file)->select_row(3)->update('this is row3')->save();
an other question if i have class and i wont make plugin for it , every plugin in each php file separate... my Ex.
class Foo {
function foo1() {
print 'foo foo';
}
}
function plugin_foo(){
print 'this from plugin_foo';
}
$foo = new Foo;
print $foo->foo1()->plugin_foo()
oop->open(file)->select_row(3)->update('this is row3')->save();
an other question if i have class and i wont make plugin for it , every plugin in each php file separate... my Ex.
class Foo {
function foo1() {
print 'foo foo';
}
}
function plugin_foo(){
print 'this from plugin_foo';
}
$foo = new Foo;
print $foo->foo1()->plugin_foo()
Upvotes: 1
Views: 143
Reputation: 5084
It is called method chaining. By returning the instance of the itself, it can chain calls.
class Foobar
{
function foo()
{
echo 'hi';
return $this;
}
}
Upvotes: 1
Reputation: 169
You need to return the object of that same class in every methods.
Upvotes: 0