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

请问代码报错原因

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:55:361060browse

请教代码报错原因

<?php<br /><br />class test{<br />	public $start;<br />	public $end;<br />	public $arr=array();<br />	public function add(){	<br />		foreach(range($start,$end) as $v){<br />			echo $v;<br />		}<br />	}<br />}<br />$test1=new test();<br />$test1->start=1;<br />$test1->end=100;<br />$test1->add();<br /><br />?>

这段代码为什么会报错呢?
------解决方案--------------------
第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