How to use functions [closed]

To answer your question, the current method would be to create the object then call the method:

$objClassName = new ClassName();
$var = $objClassName->updateRegularBalance(5);

Another way would be to make the method static since the class has no private data(In your case) to rely on:

public static function updateRegularBalance($amount){}

This can then be called like so:

$var = ClassName::updateRegularBalance(5);

As of PHP 5.3.0, it’s possible to reference the class using a variable. The variable’s value can not be a keyword (e.g. self, parent and static).

Lastly, you do not need a class and can just have a file of functions which you include. So you remove the class ClassName and the public in the method.

Have a look at the PHP manual section on Object Oriented programming.

Let me know in case of any concern.