What is advantage of function class over a usual function? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is advantage of function class over a usual function?

function fName(){#code} class Cname{ public function fName(){ #code } }

2nd Feb 2019, 6:30 PM
Aphro10
Aphro10 - avatar
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.
6th Feb 2019, 8:08 AM
FIP
FIP - avatar
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....
7th Apr 2019, 11:43 PM
Anand Raj Singh
Anand Raj Singh - avatar