PHP – class with functions

After some time with JS and Python, this week I have decided to continue with PHP. So, let’s see how you can make a class with a function in PHP.

php-elephant

My class would be called Investment, with 3 public variables – interest, amount and result. The function would take two variables and produce value to the third.

Like this:

And this happens if you call it in a browser:

phpClass

 

Yup, I really have Apache on port 81 :).

The code is available in GitHub here.

Enjoy it!

About

VBA Developer

Tagged with: ,