Home  >  Article  >  Backend Development  >  php新手请问

php新手请问

WBOY
WBOYOriginal
2016-06-13 11:54:12779browse

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

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

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