前置知识可变变量这是PHP的一个特性,允许一个变量中的内容作为变量名使用,作用上类似于其他的指针。代码示例$a = "Cat"; $b = "a"; $$b = "Dog"; echo $a;运行结果:Dogextract()函数extract()函数从数组中将变量导入到当前的符号表。该函数使用数组键名作为变量名,使用数组键值作为变量值。针对数组中的每个元素,将在当前符号表中创建对应的一个变量。该函数返回成功设置的变量数目。用PHP代码进行实现的话:foreach($my_array as $x => $y) { $$x = $y; }参考: 菜鸟教程代码示例$a = "Original"; $my_array = array("a" => "Cat","b" => "Dog", "c" => "Horse"); extract($my_array); e
Equinox
一个乐于分享的网安人