3月 112011
 
 
  1. <?php
  2. c = 5;
  3. echo $c."\n";
  4. echo m();echo "\n";
  5. echo $c."\n";
  6. function m() {
  7.         static $c = 9;
  8.         return $c++;
  9. }
  10. ?>

输出结果:
5
9
5

关键点:

  1. static 和global的概念要区分好
  2. return 语句也遵循 $c++和++$c的区别
 
  1. <?PHP
  2. $i = 2;
  3. $j = &$i;
  4. unset($j);
  5. echo $i;
  6. ?>

输出结果:
2

关键点:
unset仅仅是解除引用

 Posted by at 上午 8:52

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

(required)

(required)

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据