I have concept of static variables but what are the benefits of static methods in a class. I have worked on some projects but I did not make a method static. Whenever I need
Syntax (php) for static methods:
Client code:
echo Number::multiply(1, 2);
Which makes more sense than:
$number = new Number(); echo $number->multiply(1, 2);
As the multiply() method does not use any class variables and as such does not require an instance of Number.
multiply()
Number