Reputation: 63
I have a problem with my current function call structure.
The structure is like this: one file called "index.php" and another file call "function.php"
Inside function.php is just function after functions
function.php
<?php
include 'settings.php';
date_default_timezone_set('Australia/Brisbane');
function one{
};
function two{
};
Index.php is just calling the functions from function.php file
Index.php
<?php
include 'include/functions.php';
$name = one():
?>
The advantage of this structure is when I saw the function has an error on index.php, I can just crt-f(find) in function.php and debug the function easily.
The other way around is cause me problem. I went through the function.php and saw some functions kinda doing the same things. I want to delete it but I don't know where is the function call form which pages. I have hundreds page on this website.
I want to make the code more tighter but I scare any change in function.php would break the website.
Yes, I can test the website after every change in function.php but to test the whole website for one function to be delete. It is time consuming. That's assume I test it correctly.
How would you guys handle this situation?
Many thx in advance ;)
Upvotes: 1
Views: 164
Reputation: 2927
With an 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 when you are going to modify/extend/delete code/functions.
Upvotes: 1