I want the method to add two values, but occasionally there are more than two values and in this case they will be in the form of an array. The idea is to total the values in the array when it has values assigned to it.
I did think about just using an array regardless of the number of values and adding the values in the array. Perhaps there is a case to be made for a method that totals the values in an array instead of relying on the add method?
If you're interested in learning PHP object-oriented programming, start your adventure here:
In particular, try to stay away from internet examples. The "good work" in PHP OOP design and programming is being done in systems like Laravel, and it's all very, very new in PHP. An unfortunately large amount of really bad PHP code is lying around on the internet, so check the publication dates and steer yourself away from anything more than a year or two old.