PHP bug??global发现的问题
如下php代码
<?php
$type='a';
$target='type';
$a=array(1,2,3);
a($target);
function a($type)
{
global $$type;
var_dump($$type);
}
?>
预计输出的是string(1)”a”
可是结果是
Notice: Undefined variable: a in D:\web\global.php on line 11
NULL
因为global的时候引进了$type,顺便把全局的$type引进了,函数内部的$type的值被修改成了全局的'a',而函数内部又没有$a,所以报错和打印null
不知道这是php的错误还是就是global的机制,不过个人认为这个情况下只引进$type就可以了
相关文档:
几天没有更新的blog这两天在写个小东西玩玩
现在是基本能用了
最近没什么事做,就想到了查看服务端目录的小程序玩玩
现在查看已经写完了发上来给大家看看
demo地址
http://www.web-jia.com/demo/folder/demo.html
我分享的代码欢迎大家来下载啊
下载可以到
http://www.web-jia.com/viewthread.php?tid=2832&ext ......
1 文件结构
|
|――images
|――include
|――parameter
|――config
|――function
|――index
images存放图片文件,include中是系统是要引用的文件,一般在parameter中存放参数文件,config中存放配置文件,function中存放方法文件,如javascript的方法等,并按功能模块的分类,将各功能的类也放入其 ......
这里50个有益的PHP工具,可以大大提高你的编程工作:
调试工具
Webgrind
Xdebug
Gubed PHP Debugger
DBG
PHP_Debug
PHP_Dyn
MacGDBp
测试和优化工具
PHPUnit
SimpleTest
Selenium
PHP_CodeSniffer
dBug
PHP Profile Class
文档工具
phpDocumentor
PHP DOX
安全工具
Securimage
:验证码工具。
Scave ......
方法1:error_reporting (E_ALL ^ E_WARNING);
session_start();
方法2:error_reporting (E_ALL & ~E_NOTICE);
if (!isset($_SESSION)) {
session_start();
};
方法3:改php.ini 中error_reporting ......
代码interface StringSearchable
{
public function search($substring, $buffer);
}
class BoyerMooreStringSearch implements StringSearchable
{
public $substring = null;
public ......