__autoload() function can be very useful to optimize your code esp. when you have so…