Use PHP to implementation those magic function