Home >Backend Development >PHP Tutorial >请教代码报错原因

请教代码报错原因

WBOY
WBOYOriginal
2016-06-23 13:58:23919browse

<?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){

非常感谢版主!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn