乐杨俊:PHP extract() 函数
来源:互联网 发布:除了钢炼fa 动漫 知乎 编辑:程序博客网 时间:2024/05/16 15:15
用法:
PHP extract() 函数从数组中把变量导入到当前的符号表中。
对于数组中的每个元素,键名用于变量名,键值用于变量值。
第二个参数 type 用于指定当某个变量已经存在,而数组中又有同名元素时,extract() 函数如何对待这样的冲突。
本函数返回成功设置的变量数目。
案例1
<?php$a = 'Original';$my_array = array("a" => "Cat","b" => "Dog", "c" => "Horse");extract($my_array);echo "\$a = $a; \$b = $b; \$c = $c";?>
输出:$a = Cat; $b = Dog; $c = Horse
案例2
使用全部参数:
<?php$a = 'Original';$my_array = array("a" => "Cat","b" => "Dog", "c" => "Horse");extract($my_array, EXTR_PREFIX_SAME, 'dup');echo "\$a = $a; \$b = $b; \$c = $c; \$dup_a = $dup_a;";?>
输出:
$a = Original; $b = Dog; $c = Horse; $dup_a = Cat;
- 乐杨俊:PHP extract() 函数
- PHP extract() 函数
- php 模仿extract函数
- PHP extract() 函数
- PHP extract() 函数
- PHP extract() 函数
- PHP extract()函数
- PHP函数 extract()
- PHP extract() 函数
- PHP extract() 函数
- php中的extract函数
- PHP compact() 、 extract() 函数
- PHP extract() 函数的用法
- PHP中extract()函数的妙用
- PHP中extract()函数的妙用
- PHP中extract()函数的妙用
- PHP中extract()函数的妙用
- PHP 数组导出(extract函数)
- 欧巴甘南塞!
- 爱爱爱爱哎你遗忘你
- GZip对字符串压缩和解压
- SQL Server 2008的BI组件SSAS使用详解
- android.graphics四、Android中图像变换Matrix的原理
- 乐杨俊:PHP extract() 函数
- 和和呵呵呵呵呵呵好狠比
- supervise进程监控工具
- 无法kill掉进程
- asdadasdsad123
- 刚才那个不算
- vbs的asc无法返回非法字符的asc码值
- 打色卡江诗丹顿
- 出自诗经的成语出自三国志的成语