Just give a brief explanation:
Copy code The code is as follows:
class test {
private $_name = '';
public function setName($name)
{
$this->_name = $name;
return $this;
}
public function getName ()
{
echo $this->_name . "n";
return $this;
}
}
$link = new test();
//Method chain
$link->setName('name1')->getName()->setName('name2')->getName()->setName('name3')-> ;getName();
The result is as follows:
Copy code The code is as follows:
name1
name2
name3
http://www.bkjia.com/PHPjc/324583.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/324583.htmlTechArticleA brief explanation: Copy the code as follows: ?php class test { private $_name = ''; public function setName ($name) { $this-_name = $name; return $this; } public function getName...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn