Empty array-php Tutorial

Source: Internet
Author: User
The array to be empty is now 206 records, some of which are empty. When all the records in a record are empty, the record with this submark will be released (you can judge all, or there is a special subscript here. if the status is empty, this record will be empty, for example, array [1] means that all elements are empty)

$ Countarr = count ($ newplayer );
For ($ I = 0; $ I <$ countarr; $ I ++ ){
If ($ newplayer [$ I] ['status'] = ''){
Unset ($ newplayer [$ I]);
}
}

Poor


Reply to discussion (solution)

I forgot to say thank you. thank you first.

 '; Print_r ($ arr); foreach ($ arr as $ key => $ val) {$ num = 0; foreach ($ val as $ key1 => $ val1) {if (empty ($ val1) {unset ($ arr [$ key] [$ key1]) ;}else {$ num ++ ;}} if ($ num = 0) {unset ($ arr [$ key]);} else {sort ($ arr [$ key]) ;}} sort ($ arr ); print_r ($ arr); echo'
';?>
I don't know if the landlord wants this effect. the new guy just played in this community. let's talk about it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.