This article mainly introduces how to use PHP to continuously call functions using chain calls. Friends who are interested can refer to it. I hope it will be helpful to everyone.
The details are as follows:
<?php //返回$this,实现连续调用 class xin { function name($namec) { echo "我的名字是:$namec <br/>"; return $this; } function age($agec) { echo "我的年龄是:$agec <br/>"; return $this; } } $xind = new xin(); $xind->name("星星")->age("10000"); ?>
The running results are as follows:
My name is: Xingxing
My age is: 10000
Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study.
Related recommendations:
PHP How to use Socket to obtain the SSL certificate and public key of the website
The above is the detailed content of How to use PHP to continuously call functions using chain calls. For more information, please follow other related articles on the PHP Chinese website!