Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
对于 PHP,是否可以执行以下操作:
array( $designationVar => $dataVar );
我的想法是我可以根据存在的值动态创建一个数组
Yes why not , this is equivalent to like this
$arr = array(); $arr[$keyname] = $value;
In your case
$arr = array(); $arr[$designationVar] = $dataVar;