谁能帮我详细解答下这段代码啊 新手问题
<?php
class MyArray{
protected $Total;
protected $Start;
protected $Step;
protected $Ratio;
function __construct($Total=10,$Start=3,$Step=3,$Ratio=10){
$this->Total=$Total;
$this->Start=$Start;
$this->Step=$Step;
$this->Ratio=$Ratio;
}
function ReturnArray(){
$array=array();
for($i=$this->Start;$i<=$this->Total*$this->Step;$i=$i+$this->Step){
$array[$i]=$i*$this->Ratio;
}
return $array;
}
function PrintArray(){
print_r($this->ReturnArray());
}
}
//实例化类
$newarr=new MyArray();
print_r($newarr->ReturnArray());
echo $newarr->PrintArray();
?>
class MyArray{
protected $Total;
protected $Start;
protected $Step;
protected $Ratio;
function __construct($Total=10,$Start=3,$Step=3,$Ratio=10){
$this->Total=$Total;
$this->Start=$Start;
$this->Step=$Step;
$this->Ratio=$Ratio;
}
function ReturnArray(){
$array=array();
for($i=$this->Start;$i<=$this->Total*$this->Step;$i=$i+$this->Step){
$array[$i]=$i*$this->Ratio;
}
return $array;
}
function PrintArray(){
print_r($this->ReturnArray());
}
}
//实例化类
$newarr=new MyArray();
print_r($newarr->ReturnArray());
echo $newarr->PrintArray();
?>
作者: zhuowenji 发布时间: 2011-10-20
你哪里看不懂呢?
作者: yao657355700 发布时间: 2011-10-21
我也学习学习
作者: greatming 发布时间: 2011-10-21