$firstname = "Bill";
$lastname = "Gates";
$age = "60";
$result = compact("firstname", "lastname", "age");
print_r($result);
输出:
Array ( [firstname] => Bill [lastname] => Gates [age] => 60 )
$firstname = "Bill";
$lastname = "Gates";
$age = "60";
$result = compact("firstname", "lastname", "age");
print_r($result);
输出:
Array ( [firstname] => Bill [lastname] => Gates [age] => 60 )
《compact 创建一个包含变量名为数组的键和它们的值为数组的值的数组.doc》
下载本文的Word格式文档,以方便收藏与打印。
今天就跟大家聊聊有关使用JavaScript如何提升变量和函数,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。 1在js中只有两种作用域 a:全局作用域 b:...
2024-03-14编程代码javascript,函数,变量一、javascript: 代码: /* @desc:数组和对象互转类 @param data 待转换的数据 */ function arrobj(data){ this.data = data /* @desc:对象转数组 */ this.objtoarr = function(){ var data = this.dat...
2023-10-27编程代码javascript,PHP,数组本篇文章和大家了解一下JavaScript的Array数组方法的介绍。有一定的参考价值,有需要的朋友可以参考一下,希望对大家有所帮助。 数组的方法 1. push() 添加 该方法可以向数组中添加一个或多个元素,并返回数组...
2023-10-27编程代码Array,javascript,数组