dudleylearning Posted December 2, 2016 Share Posted December 2, 2016 Hi, is it considered good practice to place user defined functions into a separate file (i.e. functions.php) or have one created for set parts of the application (i.e. jokes-functions.php)? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/302663-user-defined-functions-in-separate-file-or-not/ Share on other sites More sharing options...
Solution Barand Posted December 2, 2016 Solution Share Posted December 2, 2016 Horses for courses. It depends on where you will use the function. If it is specific to one page, define it in that page. If it is used by more than one page then define it in a separate file. So some will be defined in the page, some in an application-specific function file and some in general function file. Quote Link to comment https://forums.phpfreaks.com/topic/302663-user-defined-functions-in-separate-file-or-not/#findComment-1539963 Share on other sites More sharing options...
dudleylearning Posted December 2, 2016 Author Share Posted December 2, 2016 Great. thanks for the super quick response. Quote Link to comment https://forums.phpfreaks.com/topic/302663-user-defined-functions-in-separate-file-or-not/#findComment-1539967 Share on other sites More sharing options...
Jacques1 Posted December 2, 2016 Share Posted December 2, 2016 You definitely need to group functions by their purpose. Stuffing everything into one big functions.php script will quickly lead to an unreadable, unmaintainable mess. Quote Link to comment https://forums.phpfreaks.com/topic/302663-user-defined-functions-in-separate-file-or-not/#findComment-1539977 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.