php 函数调用结构

php function calls structure

我当前的函数调用结构有问题。

结构是这样的: 一个名为 "index.php" 的文件和另一个名为 "function.php"

的文件

里面function.php只是函数之后的函数

function.php

<?php 
include 'settings.php';
date_default_timezone_set('Australia/Brisbane');

function one{
};

function two{
}; 

Index.php 只是调用 function.php 文件中的函数

Index.php

<?php
include 'include/functions.php';
$name = one():
?>

这种结构的好处是当我看到函数在index.php上有错误时,我可以在function.php中crt-f(find) 并轻松调试函数。

反之则给我带来麻烦。我浏览了 function.php 并看到一些功能有点做同样的事情。我想删除它,但我不知道哪个页面的函数调用在哪里。我在这个网站上有数百页。

我想让代码更紧凑,但我担心 function.php 中的任何更改都会破坏网站。

是的,我可以在 function.php 每次更改后测试网站,但要测试整个网站是否有一个功能要删除。这很耗时。这是假设我测试正确。

你们会如何处理这种情况?

提前致谢 ;)

IDE like Zend Studio or Aptana you can search the usage of a function. If a function is not used anywhere, you can delete id whitout having problems (except you make function calls with variable or buildet function names). For more safety i suggest you to make functional tests for your projects with PHPUnit 当你要去 modify/extend/delete code/functions.