Home > Backend Development > PHP Tutorial > array加入新阵列如何宣告?

array加入新阵列如何宣告?

WBOY
Release: 2016-06-23 13:39:53
Original
754 people have browsed it

$data=Array ('id' => 123,'name' => name);
Copy after login

用array_push会出错,请问要怎么宣告?


回复讨论(解决方案)

你臆造出的新名词,有谁能懂?

目前要加新的阵列值上去
原本:

Array ('id' => 123,'name' => name);
Copy after login

加上:
Array ('type' => 1);
Copy after login

变成:
Array ('id' => 123,'name' => name,'type' => 1);
Copy after login

请问要怎么改?

$a = Array ('id' => 123,'name' => 'name');$a['type'] = 1;
Copy after login

$data['type'] = 1;

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template