When to use a Class vs. Function in PHP -


Lightbulb is still running for it ...

I really like an easy task Using a class in php to understand the interpretation of the benefit

A simple example of this idea is that I am doing now and thinking that a class is more efficient: / P>

Say I have a small calendar widget that I have created in PHP. I'm thinking of calling the function miniCal ('arrayVars1', 'var2') . But I can do this twice on that page. Use lesser resources here, using a square, create new versions of it?

What should I bark here, because I think the tree is a brick wall ...

Categories are used to represent data in the form of objects, if you are representing something like user data, or auction bid, then by creating user objects or auction objects that Put together the data, pass it around in your code and read it To not do it easily understandable. In these sections, the attributes (data fields like numbers, strings, or other objects), along with the methods (the functions that you can operate on any class) will be.

Classes usually do not offer any benefits, but they have very little or no negative impact. Their actual advantage is in clearing the code.

I advise you to read more.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -