java程序员学php – 8. 神奇的extract()

声明这样一个关联数组:

  $map[‘BJ’] = ‘Beijing’;

  $map[‘SH’] = ‘Shanghai’;

然后做一下extract($map), 你就可以自动获得 $BJ 和 $SH这两个变量,它们的值分别为Beijing和Shanghi。

也就是说,extract替你编程了。这在Java语言里还是很难想象的。

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.