I would like to "namespace" a collection of functions and call them. The reason is that I'd like to keep the function names the same across multiple files (and thus distinguish them by namespace). My below implementation yields a "Call to undefined function..." error:
main.php:
//located in /src/main.php
namespace Roles;
use functions\Form; //doesn't seem to work
use functions\View; //doesn't seem to work
use Silex\Application; //works
use Silex\ControllerProviderInterface; //works
class mainfct {
//calls respective functions in the namespaces
Form\a();
Form\b();
View\a();
View\b();
}
form.php:
//located in /src/functions/form.php
namespace Form;
function main() { a(); b();};
function a() {...};
function b() {...};
view.php:
//located in /src/functions/view.php
namespace View;
function main() { a(); b();};
function a() {...not necessarily same code as above...};
function b() {...not necessarily same code...};
The above doesn't seem to work. What's the best way to implement this?