+ 3
What is advantage of function class over a usual function?
function fName(){#code} class Cname{ public function fName(){ #code } }
2 Answers
+ 1
There are 2 main concepts of programming in PHP:
- Procedural programming
- Object Oriented programming ( OOP )
You use Classes, methods, properties and objects when you work OOP,
why would you use OOP over Procedural programming ?
The concept of OOP brings the idea of Re-usability, dynamic nature, inter communication within the blocks, multi-threading, etc which are missing in procedural language.
If you don't understand what I just mentioned here don't worry it's a bit harder to grasp the oop concept but there are many tutorials that help and once you understand the concept you will use it with joy.
I hope I helped.
0
It's not a function class.... Both functions are same....
Just their way of using are somewhat different....
First one is used within a program directly... While the next one is first generalised in a class... And is used after a object of that class is used....