Home  >  Article  >  Backend Development  >  PHP初记(2) - extract()方法

PHP初记(2) - extract()方法

WBOY
WBOYOriginal
2016-06-13 13:03:57781browse

PHP小记(2) - extract()方法

定义和用法

PHP extract() 函数从数组中把变量导入到当前的符号表中。

对于数组中的每个元素,键名用于变量名,键值用于变量值。

第二个参数 type 用于指定当某个变量已经存在,而数组中又有同名元素时,extract() 函数如何对待这样的冲突。

本函数返回成功设置的变量数目。


一般用途:

extract($_REQUEST)

extract($_GET)

extract($_POST)

?

这样可以把提交上来的参数直接转换为$变量名和变量值

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