Home >Backend Development >PHP Tutorial >代码如图所示,请教用数组还是switch

代码如图所示,请教用数组还是switch

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:09:241090browse

代码如图所示,请问用数组还是switch?

请问该用数组呢还是下面的switch方式?
所需要的值随便写的,实际不一定这么规律。
看了一篇文章说少用数组

------解决思路----------------------
显然是用数组简洁点啊。用list更简洁:
list($c1, $c2, $c3, $c4) = $color[$a];

------解决思路----------------------
这不是很明显吗?用数组简便一点.

Statement:
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