How to write a statement that calls multiple methods of a class

Source: Internet
Author: User
How can I write a statement that calls multiple methods of a class? For example, $ this-& gt; m_button6PaneInfo-& gt; Movable (& nbsp; false & nbsp;)-& gt; Dock ()-& gt; Fixed () -& gt; BottomDockable (& nbsp; false & nbsp;)-& gt; TopDockable (& nbsp; false & nbs calls multiple methods of a class in one line of statements, how to write?
For example:
$this->m_button6PaneInfo->Movable( false )->Dock()->Fixed()->BottomDockable( false )->TopDockable( false )->Layer( 10 )->ToolbarPane();

$ This-> m_button6PaneInfo is a class instance. The following are all methods of this class.
This statement cannot be passed, at least in my php version.

In addition to splitting multiple rows, how can this line be modified? Can it be correctly executed?
Or to which version? Can be written in this way
------ Solution --------------------
Write in this way
class testcls{
function fun1(){
echo 'fun1';
return $this;
}
function fun2(){
echo 'fun1';
return $this;
}
function fun3(){
echo 'fun3';
return $this;
}
}
$test = new testcls();
$test->fun1()->fun2()->fun3();

------ Solution --------------------
The premise of a chained operation. each operation returns the object itself.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.