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

请教代码报错原因

WBOY
Release: 2016-06-23 13:58:23
Original
922 people have browsed it

<?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();?>
Copy after login

这段代码为什么会报错呢?


回复讨论(解决方案)

第8 行应为
foreach(range( $this->start, $this->end) as $v){

非常感谢版主!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template