Home >Backend Development >PHP Tutorial >请教代码报错原因
<?phpclass test{ public $start; public $end; public $arr=array(); public function add(){ foreach(range($start,$end) as $v){ echo $v; } }}$test1=new test();$test1->start=1;$test1->end=100;$test1->add();?>
第8 行应为
foreach(range( $this->start, $this->end) as $v){
非常感谢版主!