Home > Backend Development > PHP Tutorial > php foreach 循环数组 并设定key,该如何处理

php foreach 循环数组 并设定key,该如何处理

WBOY
Release: 2016-06-13 12:45:22
Original
1080 people have browsed it

php foreach 循环数组 并设定key

<br />
<br />
foreach($role as $k=>$v){<br />
	$arrayRole[$k=$v->role_id]=$v->role_code;					<br />
<br />
} <br />
<br />
Copy after login



如题   我写的  key  总是设置不了 

Related labels:
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