function重复使用的有关问题

WBOY
Release: 2016-06-13 12:55:10
Original
859 people have browsed it

function重复使用的问题

<br />
function a(){<br />
  //代码<br />
}<br />
<br />
function b(){<br />
  //代码<br />
  //还要用到a()里面的代码<br />
}<br />
Copy after login


我不知道这样表示,正不正确,
大概意思就是这样。

这个应该怎么写?
或者应该查看什么资料可以详细的学习?


------解决方案--------------------
如果是a全部,就这样
function b(){
  //代码
  a()
}
如果是部分,那a()还应该拆分为多个
但无论如何,还是要看实际需求,沿着这个方向走,你会走向面向对象的
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!