lmhart Posted October 21, 2009 Share Posted October 21, 2009 I am very new to php and have a few questions about functions. Wondering if php will allow you to store all your functions in one file and then make a call to that file when needed(like with javascripts)? Or if you have to put the function in each page. If that is the case --> what is the point of functions? I am trying to make my pages/scripts the most efficient that they can be. Also I am trying to avoid writing un-necessary code. Link to comment https://forums.phpfreaks.com/topic/178494-functions-questions/ Share on other sites More sharing options...
cags Posted October 21, 2009 Share Posted October 21, 2009 You can write them all in a seperate file and then simply use... include 'functions.php'; ...on any page you wish to use any of the functions. Link to comment https://forums.phpfreaks.com/topic/178494-functions-questions/#findComment-941283 Share on other sites More sharing options...
lmhart Posted October 21, 2009 Author Share Posted October 21, 2009 Ok I am familiar with the include statement. is this considered good coding standards? Link to comment https://forums.phpfreaks.com/topic/178494-functions-questions/#findComment-941298 Share on other sites More sharing options...
cags Posted October 21, 2009 Share Posted October 21, 2009 Yes. You are essentially creating a library of code that you can call whenever you need it. Link to comment https://forums.phpfreaks.com/topic/178494-functions-questions/#findComment-941303 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.