Welcome! Log In Create A New Profile

Advanced

portfolio - functions

Posted by kreason_77840070 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
portfolio - functions
May 17, 2013 04:16PM
Hey guys

what are some of the things you used functions for ? So far the only thing I used it for was validation

http://capetown-airport.co.za/
Re: portfolio - functions
May 17, 2013 04:28PM
you can use a function for just about anything

eg insert, update, delete. you can have a function like AddNewStudent, UpdateStudent, AddCourse, EditCourse, DeleteStudent, SendMail ...anything
avatar Re: portfolio - functions
May 20, 2013 08:28AM
Yep. I think my func.php has more code in it than any of my other php pages. Just about everything is running in a function.
Re: portfolio - functions
May 20, 2013 10:10AM
Correct me if I am wrong. The purpose of a function is if you are going to use a block of code more than once on any given page or diffirent pages you include that code in a function. I would not include everything as it would be hard to understand the code when you come back to it if almost everything was put in a function. Meaning you have to go back and forward the hole time to try and understand what the purpose of the given code was.

Student Number: 78042879 (Part Time Courses)
Re: portfolio - functions
May 20, 2013 10:26AM
you are thinking of it more in OOP line.
avatar Re: portfolio - functions
May 20, 2013 10:51AM
Anton

If you have all your functions in one place it is easier to update or change something. You don't need to go through all you code to find a certain function to change something.
Re: portfolio - functions
May 20, 2013 10:54AM
77911997 Wrote:
-------------------------------------------------------
> you are thinking of it more in OOP line.

Yes, but a function is very close to OOP. Function is a method with or without propperties(parameters). Infact most of the build in functions in PHP comes from a certian class stream. You know what I mean. Yes I know you should only describe a function as a method inside class. Else I do not see the point of taking 1x block of code that is only going to run once and put that in a function.

Mac if you do not mind shedding some light on this ?

Student Number: 78042879 (Part Time Courses)
Re: portfolio - functions
May 20, 2013 11:31AM
a function is not necessarily a method inside a class. think programming 101, you are way too advance if you thinking OOP when we talking function.

but yes you are most correct. its just that juniors don't do it the OOP way.
you simple declare a function and call it, no class needed.
Re: portfolio - functions
May 22, 2013 09:48AM
I feel so "junior" smile

Glen
avatar
Mac
Re: portfolio - functions
May 23, 2013 08:04AM
Yes, a function is useful when you want to use that code in more than one place, meaning you update only one place.But a function can be used once in a project, and used again in another project, which saves time coding

Then there are the preset PHP functions that are very useful.
Sorry, only registered users may post in this forum.

Click here to login