I'm getting this error
Fatal error: Cannot redeclare getAllStaff() (previously declared in /Applications/XAMPP/xamppfiles/htdocs/StaffTools/database/StaffHandler.php:5) in /Applications/XAMPP/xamppfiles/htdocs/StaffTools/database/staffHandler.php on line 15
I'm building an application in Apatana Studio 3 and I renamed a file from staffHandler.php to StaffHandler.php (uppercase S) so the former no longer exists.
I get all my PHP files from the database directory using the below PHP code
foreach(glob("database/*.php") as $filename) {
include $filename;
}
And then call a method called getAllStaff() here:
<select name="staff">
<?php getAllStaff(); ?>
</select>
Obviously, this method is now in StaffHandler.php. This was working fine until I changed the filename of the name.
Things I've tried
- Clearing my cache in Firefox
- Rebuilding & cleaning my project in Aptana
- Changing the filename back to
staffHandler.php - Conditional function statemet
if(!function_exists....
Why on earth would PHP throw an error like that for a file that doesn't exist anymore?
UPDATE: RESOLVED
I had a reference to the staffHandler.php file buried within all my PHP scripts and I think this was the source of the problem. When I ran ls -la at the terminal in the database directory only StaffHandler.php appeared but when I ran find staffHandler.php and rm staffHandler.php it erased both staff and Staff. Must've been some kind of link between created by application code.