Home > Backend Development > PHP Tutorial > 种外边的独立的自定义函数和类中静态方法有啥区别啊

种外边的独立的自定义函数和类中静态方法有啥区别啊

WBOY
Release: 2016-06-13 11:34:48
Original
873 people have browsed it

类外边的独立的自定义函数和类中静态方法有啥区别啊?

<br /><br />function test(){<br />	………<br />	return $result;	<br />}<br /><br />function test1(){<br />	………<br />	return $result;	<br />}<br /><br />……<br /><br />function testN(){<br />	………<br />	return $result;	<br />}<br /><br /><br />class funs{<br />	static function test(){<br />		………<br />		return $result;	<br />	}<br />	static function test1(){<br />		………<br />		return $result;	<br />	}<br />	……<br />	static function testN(){<br />		………<br />		return $result;	<br />	}<br />}<br /><br /><br />$a = test();<br />$b = funs::test()<br /><br />……<br /><br />
Copy after login




写在类外边的单独的函数和写在类里边的静态的函数有啥区别?类外边的函数是静态的吗?也像教程中所说的静态的方法节约内存么?它们如果非要比比效率,哪个高啊?

把常用的函数写在类里定义为静态方法有好处么?

我是新手,请老手给予正确的指点!

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