zoukankan      html  css  js  c++  java
  • 关于PHP中变量的判定

    由于PHP解释性语言,所以一个变量即使没有定义也可以被使用而不会引起error。请看下面这个例子:

     

    输出的结果是:

    empty

    no set

    Notice: Undefined variable: test in C:/AppServ/www/test2.php on line 11

    null

    Notice: Undefined variable: test in C:/AppServ/www/test2.php on line 14

    no defined

    Notice: Undefined variable: test in C:/AppServ/www/test2.php on line 18

    case 0

    有其实最后一个switch判断,这是一个比较隐晦的错误,所以在使用前进行一次判断还是有意义的。同时我们可以看到有些的判断方式会引起Notice而有些不会。至于判断的解读,请参考另一篇文章:http://blog.csdn.net/autofei/archive/2010/05/24/5619004.aspx

  • 相关阅读:
    Django -- 路由系统(URLconf)
    Django简介
    jQuery
    DOM
    JavaScript
    HTML,CSS
    Redis PK Memcached
    ORM框架-SQLAlchemy
    Memcached操作以及用法
    Py3快速下载地址
  • 原文地址:https://www.cnblogs.com/ainima/p/6331335.html
Copyright © 2011-2022 走看看