Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
myss45274yPlain basics (oversimplified for better understanding):
Method = function inside of a class
Trait = a piece of class which you include inside of a multiple classes to reuse the code better and don't repeat yourself, made specifically cause there's no multiple inheritance in php -
Trait is like a reusable method that you can use in a class? It’s been a while but that’s how I viewed it
-
Yes? You can add properties but I think they might have to be public/protected? Not sure they can be private? Can’t remember? But if you can do something, use an abstract or instance
Related Rants
Who can explain better traits and method in php?
question
php