php新手请问

WBOY
Release: 2016-06-13 11:54:12
Original
813 people have browsed it

php新手请教
现在自学PHP 看的是兄弟连的视频教程 学到变量范围的时候 视频老师的例子是  :
$a = 10;
function demo(){
       $a+=10;
}
demo();

可是我在照做例子的时候出现
Notice: Undefined variable: a  这样的错误提示,在函数里先给$a赋值就没问题了。我的是5.3+的。是不是php版本的问题?
------解决方案--------------------
因为他把notice错误级别屏蔽了。
你在首行加上:error_reporting(E_ALL & ~E_NOTICE); 也不会报错。

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