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

多维数组判断

WBOY
Release: 2016-06-23 13:23:55
Original
909 people have browsed it

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]);}
Copy after login
Copy after login

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


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