数组类,如果我有两个阵列,即使用PHP创建
$text = 'i am passed :)';
$fn = array(
':)',
':-)',
';;)'
)
$rep = array(
'smily1',
'smily2',
'smily3'
);
$output = str_replace($fn, $rep, $text);
echo $output;
我想打一个类此的未来,我将要使用... 我怎样才能使一个类吧...
而且我怎样才能在一个类中封装你的函数创建此功能...
我真的没有看到一个技术问题在这里。为什么不使用你已有的方法?创建一个类来包装这个功能很简单。 – 2010-01-06 20:00:44
你想让这堂课做什么?你正在创建一个“SmileyReplacer类”?你有什么问题,为什么它应该是一个班级? – Tesserex 2010-01-06 20:01:07
你也可以看看这个问题:http://stackoverflow.com/questions/65091/making-a-php-class-behave-like-an-array – 2010-01-06 20:13:05