Home >Backend Development >PHP Tutorial >多维数组判断

多维数组判断

WBOY
WBOYOriginal
2016-06-23 13:23:55898browse

city[x] [y] 
x储存省的id
y储存x省的城市的id
如果city[x]下没有数据  
说明省是空的 可以删除
反之不能           怎么解?


回复讨论(解决方案)

count(city[x]) == 0

count(city[x]) == 0


这是能删除的语句么?    能不能写个全面点的。谢谢

foreach($city as $key->$item) {  if(count($itrm) <== 0) unset($city[$key]);}

foreach($city as $key->$item) {  if(count($itrm) <== 0) unset($city[$key]);}


谢谢哈  很好   但是我想说一下您那个代码是不是有地方写错了   ,哈哈
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