I want to make use of traits in my project, and for multiple inheriance I want to use traits.
So I created some traits to use eg: tItem_Epic, tItem_Weapon, Item_Driver
When I create new class for Sword, I thought I could use eval to create class:
<?php
function new_item_class($type)
{
eval('class Item_'.ucfirst($type).' extends Item_Driver { use tItem_Epic, tItem_Weapon; }');
}
?>
This is an example. There are some more parameters that change the course of eval (like: item quality, etc.).
Does this slow down the progress? Or should I create a file for every item type and call them when needed? which one will be faster?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…