i wanted to know the difference between having a collection of functions i could create in a PHP file compared to a PHP class file?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
for practical purposes, the
CLASSis different because it can be instantiated. When it is instantiated it will have its own unique properties and values.In this way you can have the same class instantiated multiple times each with their unique properties.
a common example of this would be a character in a game; i.e. you have a class called
enemy. you produce 5 enemies by instantiating the class that many times. Each will have their own properties, life, speed, etc… you can access each of the instantiations individually and run methods within that adjust their properties.