PHP create a class with dynamic variables

PHP provides overloading methods to help you create dynamically properties and methods. In this case we will use 2 functions __set() and get(). The below is the concept of  that two functions.

__set() is run when writing data to inaccessible properties.
__get() is utilized for reading data from inaccessible properties.

Now, we will write a class with dynamic variables using __get(), set() functions.

If you do not know about magic functions in PHP, this issue will is not easy for you. But, if you know it, it is so simple.