[PHP] Classes in function parameters | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

[PHP] Classes in function parameters

What does this do and how do I use it? class SomeClass {} function someFunction(SomeClass $someClass) {}

6th Feb 2018, 5:49 PM
ReimarPB
ReimarPB - avatar
3 Answers
0
the code you posted will not do anything on its own. a class is used in object oriented programming and is used to generically describe a real world object. A function is used to group together a set of instructions. this example looks like it is calling a class inside of a function. Might be useful in some cases bit you really need to understand object oriented programming before it will make sense.
7th Feb 2018, 8:06 PM
billy
0
@billy I know, it was not meant to do anything. It was just to show what I meant by "classes in function parameters". I do understand OOP (or at least some of it), I just want to know how you can use classes in function parameters for
8th Feb 2018, 5:54 AM
ReimarPB
ReimarPB - avatar
0
Sorry I guess I miss understood.
8th Feb 2018, 5:56 AM
billy