Home > Backend Development > PHP Tutorial > Office 2010 activation method can actually use method chain in PHP

Office 2010 activation method can actually use method chain in PHP

WBOY
Release: 2016-07-29 08:47:10
Original
1132 people have browsed it

Just give a brief indication:

Copy the 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 the code The code is as follows:


name1
name2
name3

The above introduces the office 2010 activation method. In fact, method chain can also be used in PHP, including the office 2010 activation method. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template