php - Which way is better Extending classes or keeping them separate and creating multiple objects? -


can let me know, when using php classes, best way given kind of scenario : have 2 classes , b, both have different functions both used on same page.

if keep both separate have create 2 objects , use them , if extend have create 1 object. best way? or there other way situation?

you should extend php class if want inherit variables or functions parent. e.g., square, circle, , triangle classes might extend shape.

from sounds of post 2 separate entities, worth having 2 separate classes. memory consumption having class minimal.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -