When do/should I use __construct(), __get(), __set(), and __call() in PHP?
问题 A similar question discusses __construct, but I left it in my title for people searching who find this one. Apparently, __get and __set take a parameter that is the variable being gotten or set. However, you have to know the variable name (eg, know that the age of the person is $age instead of $myAge). So I don't see the point if you HAVE to know a variable name, especially if you are working with code that you aren't familiar with (such as a library). I found some pages that explain __get(),