21,891
社区成员
发帖
与我相关
我的任务
分享<pre>
<?php
function sel($num,$tag1,$tag2){
$cls = 'top'.$num;
$newcls = new $cls();
$newcls->top($tag1,$tag2);
}
class top1
{
public function top($tag1,$tag2){
echo "top me!".$tag1;
}
}
class top2
{
function top($tag1,$tag2){
echo "top u!".$tag2;
}
}
sel(1,123,456);
sel(2,123,456);
?>
</pre>
<pre>
<?php
function sel($func,$tag1,$tag2){
$func($tag1,$tag2);
}
function top($tag1,$tag2){
echo "top me!".$tag1;
}
function foot($tag1,$tag2){
echo "foot u!".$tag2;
}
sel('top',123,456);
sel('foot',123,456);
?>
</pre>